Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## AccCont
- def new
- @account = Account.new
- @account.user.build
- end
- def create
- @account = Account.new(params[:account])
- if !@account.save
- render "new"
- end
- end
- ## Form
- <% form_for @account do |f| %>
- <% f.fields_for :user do |builder| %>
- <%= builder.label :first_name %>
- <%= builder.text_field :first_name %>
- <%= builder.label :last_name, "Last Name" %>
- <%= builder.text_field :last_name %>
- <%= builder.label :email, "E-mail Address" %>
- <%= builder.text_field :email %>
- <%= builder.label :password, "Password" %>
- <%= builder.password_field :password %>
- <%= builder.label :password_confirmation, "Password Confirmation" %>
- <%= builder.password_field :password_confirmation %>
- <% end %>
- <%= f.submit "Create" %>
- <% end %>
- ##Err
- NoMethodError in AccountsController#new
- undefined method `user' for #<Account:0x25fc984>
Add Comment
Please, Sign In to add comment