title: Active Record Associations undefined method 'val' (build,create enabled by has_many,belongs_to)
body: <p>I am quite new to rails and I have a bit of trouble understanding associations. I want to make a fast forum(just the thread - post mechanism nothing else) . My models are generated by : </p>
  
  <pre><code>1. rails generate scaffold Forumthread title:string
  2. rails generate scaffold Forumpost title:string content:text username:string
  </code></pre>
  
  <p>In my models I added the associations namely:</p>
  
  <pre><code>class Forumthread &lt; ActiveRecord::Base
      has_many :forumposts, dependent: :destroy
  end
  
  class Forumpost &lt; ActiveRecord::Base
      belongs_to :forumthread
  end
  </code></pre>
  
  <p>On the show page of a thread I want to be able to make a forumpost for that thread . I am trying to do it like this : 
  view:
        &lt;%= notice %></p></p>
  
  <pre><code>&lt;p&gt;
    &lt;strong&gt;Title:&lt;/strong&gt;
    &lt;%= @forumthread.title %&gt;
  &lt;/p&gt;
  
  &lt;% form_for(@post) do |f| %&gt;
  
  &lt;div class="field"&gt;
      &lt;%= f.label :title %&gt;&lt;br&gt;
      &lt;%= f.text_field :title %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :content %&gt;&lt;br&gt;
      &lt;%= f.text_area :content %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :username %&gt;&lt;br&gt;
      &lt;%= f.text_field :username %&gt;
    &lt;/div&gt;
    &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  
  
  &lt;%= link_to 'Edit', edit_forumthread_path(@forumthread) %&gt; |
  &lt;%= link_to 'Back', forumthreads_path %&gt;
  </code></pre>
  
  <p>and controller:</p>
  
  <pre><code>def show
      @current_thread = Forumthread.find_by_id(params[:id])
      @post = @current_thread.forumposts.build
    end
  </code></pre>
  
  <p>I didn't get to the create part because it seems it doesn't work just typing <code>@current_thread.forumposts.build</code> to create an object. What am I missing ?
  I want @post to be an object of type forumpost so I can create with <code>@current_thread.forumposts.create(forumposts_params)</code>;</p>
  
  <p>At the moment I get the following error:</p>
  
  <pre><code>undefined method `val' for #&lt;Arel::Nodes::BindParam:0x007fe5c0648770&gt;
  </code></pre>
  
  <p>I will happily provide more data if it is requested! .</p>