Guest User

Untitled

a guest
Jul 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. ## AccCont
  2. def new
  3. @account = Account.new
  4. @account.user.build
  5. end
  6.  
  7. def create
  8. @account = Account.new(params[:account])
  9. if !@account.save
  10. render "new"
  11. end
  12. end
  13.  
  14.  
  15. ## Form
  16.  
  17. <% form_for @account do |f| %>
  18.  
  19. <% f.fields_for :user do |builder| %>
  20.  
  21. <%= builder.label :first_name %>
  22. <%= builder.text_field :first_name %>
  23.  
  24. <%= builder.label :last_name, "Last Name" %>
  25. <%= builder.text_field :last_name %>
  26.  
  27. <%= builder.label :email, "E-mail Address" %>
  28. <%= builder.text_field :email %>
  29.  
  30. <%= builder.label :password, "Password" %>
  31. <%= builder.password_field :password %>
  32.  
  33. <%= builder.label :password_confirmation, "Password Confirmation" %>
  34. <%= builder.password_field :password_confirmation %>
  35.  
  36. <% end %>
  37.  
  38. <%= f.submit "Create" %>
  39.  
  40. <% end %>
  41.  
  42. ##Err
  43.  
  44. NoMethodError in AccountsController#new
  45.  
  46. undefined method `user' for #<Account:0x25fc984>
Add Comment
Please, Sign In to add comment