I am running into some problems with a rails app I’m developing.. I am using the simple_form gem from https://github.com/plataformatec/simple_form and after running rails server I am seeing the following error
undefined method `email' for #<User:0x007f7c9888c950>
Extracted source (around line #7):
<%= simple_form_for User.create, :input_html => { :class => 'form-horizontal hide', :id => 'dataWithinSignIn'} do |f| %>
<div class="control-group">
<div class="controls">
#7 <%= f.input :email, :id => 'inputEmail', :placeholder => 'Email' %>
</div>
<div class="controls">
<%= f.input :password, :id => 'inputPassword', :placeholder => 'Password' %>
My source code is at https://bitbucket.org/jasonriddle/stubmoney on branch test-repo I’ve searched for hours on the internet for answers but I haven’t found an answer.
This is the only migration I see in your code:
There’s no email column there and it doesn’t look you’ve set up your users table correctly anyway since all it has is a reference to user and the default timestamps.
I would run
rake db:rollbackto drop the users table and then edit the migration to look like this before migrating again:Also, you would typically name your password column something like
encrypted_passwordand then have a virtual attribute namedpasswordin your user model. The virtual attribute is what’s used in forms. (like in your example simple_form code)