If you encounter same problem i have mine where :confirm does not work in:
<%= link_to “Delete”, location, ;confirm => “Are you sure?” %>
Solution:
1) Grab the jQuery driver at http://github.com/rails/jquery-ujs and put it in your javascripts directory. The file is at src/rails.js
2) Put these codes to your layout file:
= javascript_include_tag “http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js”
= javascript_include_tag ‘rails’
3) to authenticate ajax request from CSRF attack add this to your header :
<%= csrf_meta_tag %>
More information at: http://joshhuckabee.com/jquery-rails-3
I have encountered this just recently and this just solved the problem. Add the codes below to your application.js
function CSRFProtection(xhr) {
function CSRFProtection(xhr) { var token = $(‘meta[name="csrf-token"]‘).attr(‘content’); if (token) xhr.setRequestHeader(‘X-CSRF-Token’, token);}if (‘ajaxPrefilter’ in $) $.ajaxPrefilter(function(options, originalOptions, xhr) { CSRFProtection(xhr); });else $(document).ajaxSend(function(e, xhr) { CSRFProtection(xhr); });
Hope this helps
Problem encountered:
Installing mysql2 (0.2.13) with native extensions /home/mike/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/home/mike/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for rb_thread_blocking_region()… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Solution:
sudo apt-get install libmysqlclient15-dev
Then bundle install again and it should work.!

Recent Comments