I just added a new column to my database. The migration didn't throw any errors and the database looks like it took the migration just fine also. I have a form, as such;
<h1>Sign up as a new user</h1>
<% @user.password = @user.password_confirmation = nil %>
<%= error_messages_for :user %>
<% form_for(@user) do |f| -%>
<p><%= f.label :login %><br/>
<%= f.text_field :login %></p>
<p><%= f.fullname :fullname %><br/>
<%= f.text_field :fullname %></p>
<p><%= f.label :email %><br/>
<%= f.text_field :email %></p>
<p><%= f.label :password %><br/>
<%= f.password_field :password %></p>
<p><%= f.label :password_confirmation, 'Confirm Password' %><br/>
<%= f.password_field :password_confirmation %></p>
<p><%= submit_tag 'Sign up' %></p>
<% end -%>
The field f.fullname was the new column I added. When I try to load up the page though, it keeps throwing an error;
undefined method `fullname' for #<ActionView::Helpers::FormBuilder:0xb6fa73e4>
I have this in my user.rb model
attr_accessible :login, :email, :fullname, :password, :password_confirmation
Am I missing something here as to why Rails keeps throwing that error?
Thanks.
It looks like the error is coming from a typo in your view:
<p><%= f.fullname :fullname %><br/>
<%= f.text_field :fullname %></p>
f.fullname
should be f.label
.
A clue would be that the error is coming from FormBuilder and not an ActiveRecord derivative.