-
Notifications
You must be signed in to change notification settings - Fork 4
Authenticate #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Authenticate #7
Conversation
Clayton use some LET |
What do you think about this regex for the email? |
On the conversation about using form_for or form_tag. I have messed around a lot with forms trying to learn them and the biggest difference I have found is that the model backed form puts the params into a nested hash that allows for mass assignment. Here is the form that I used: # Non model backed
<%= form_tag "/posts" do %>
<%= label_tag :title %>
<%= text_field_tag :title %>
<br/>
<%= submit_tag "Create Post" %>
<% end %>
# Model backed
<%= form_for @post do |f| %>
<%= f.label :title %>
<%= f.text_field :title %>
<br>
<%= f.submit 'Create Post' %>
<% end %> Here are the params for a non-model backed form using form_tag:
and here are the params for the model backed form:
It's a subtle but important difference. |
One great use case for form_tags might be when you're building multiple objects with the same form. For example, I have an app that uses of form_tag to build a User from :email and :password, and a UserProfile with :address and an api call performed using :address. |
|
Don't merge. Just here for learning purposes.