Reputation: 63657
I have a model called AlphaUser. When I create a form for it, do I camelCase the symbol?
<%= form_for :alphaUser
or
<%= form_for :alpha_user
Upvotes: 0
Views: 260
Reputation: 3475
You don't want to use camel case, especially when using a symbol (e.g. :alphaUser).
If your model is AlphaUser, you'll either want to use:
<%= form_for AlphaUser.new %>
or
<%= form_for :alpha_user %>
These two approaches behave differently, so it kind of depends on what you want to do... See this post for more info on the difference: Ruby on Rails : symbol as argument in form_for
Or better yet instantiate the new object in your controller (e.g. @alpha_user = AlphaUser.new) and use that in your form_for, e.g.
<%= form_form @alpha_user %>
Upvotes: 2