Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. ///Booking Controller///
  2. @user = User.generate_random_password
  3. @user.save
  4.  
  5. ///User.rb///
  6. def self.generate_random_password
  7. generated_password = Devise.friendly_token.first(8)
  8. user = User.create!(:email => "james@james.com", :firstname => "jamo", :gender => "male", :password => generated_password)
  9. end
  10.  
  11. This creates the a new user in the DB with the fields mentioned above, when you submit the booking form.
  12.  
  13. What I cant get working is passing the information from the booking form below into the model.
  14.  
  15. ///booking form///
  16. <%= fields_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
  17. <%= f.text_field :firstname, autofocus: true, :placeholder => "First Name" %>
  18. <%= f.email_field :email, autofocus: true, :placeholder => "Email Address" %>
  19. <%= f.hidden_field :gender, :value => "male" %>
  20. <% end %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement