I installed gem \'client_side_validations\', run bundle and run rails g client_side_validations:install
Installation DIDN\"T create any js files, so I created them and put c
When you run the command rails g client_side_validations:install
it seems to only generate the initializer config/initializers/client_side_validations.rb
.
However, on the github page under the "Install" section they mention the command for copying the javascript file to the project's assets: rails g client_side_validations:copy_assets
Note: If you run Rails >= 3.1 you don't need to add the javascript file in the layout anymore, it should be sufficient to have <%= javascript_include_tag "application" %>
as long as the application.js contains the line //= require_tree .
which includes all javascript files under app/assets/javascripts
directory.
In the initializer client_side_validations.rb
file you also need to uncomment the last block:
# Uncomment the following block if you want each input field to have the validation messages attached.
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
...
end
Once you have done this you need to restart the server for the changes to take effect.