Reputation: 295
i am updating my app to rails 4 i am using
<%= form_for @application do |f|%>
<%end-%>
for the form tag but it always gives me
wrong number of arguments (3 for 2)
Upvotes: 1
Views: 2345
Reputation: 6438
To install "Client side validations" with simple_form successfully, you should check for latest versions direct from Github with latest branch.
The released gems don't work with Rails >= 4.0
gem 'client_side_validations', github: 'DavyJonesLocker/client_side_validations'
gem 'client_side_validations-simple_form', github: 'DavyJonesLocker/client_side_validations-simple_form'
Make sure your gem file does not use these versions
client-side Validation 3.2.5
client_side_validations-simple_form 2.1.0
These versions does not support rails 4.2.0
For more detail please check this link, https://github.com/DavyJonesLocker/client_side_validations-simple_form/issues/41
Upvotes: 0
Reputation: 6632
If your using Rails 4 then Client Side validation is outdated. You can check here
http://railscasts.com/episodes/263-client-side-validations?view=comments
and also if you go to the github page
https://github.com/bcardarella/client_side_validations
you can see that it says its no longer maintained.
Alternatively you can try using the CSV gem from this branch, by replacing the CSV line in your Gemfile by this
gem 'client_side_validations', github: "bcardarella/client_side_validations", :branch => "4-0-beta"
Not sure even if this will work though. Since its outdated.
Or you can check this gem out,
https://github.com/kalkov/rails4_client_side_validations
Its just a modified version of Client Side Validations
And for the whitespace stuff. lol. It can be used both at the beginning or at the end of the <% end %> tag. Its only for earlier version of Rails since in Rails 3 its no longer necessary.If an erb tag has no output it will automatically be stripped away so there’s no unnecessary whitespace where the erb tags were.
Upvotes: 1
Reputation: 671
I got the same error, it was due to client_side_validation gem. This gem is conflicting with form_for in rails 4
Upvotes: 2
Reputation: 10997
the problem could be here
<%end-%>
as it should be
<%end%> #no hyphen after the 'd'
However, I'm not sure why it would throw that error if that were the case. Is there anything between form_for
and end
?
Upvotes: 0