Wednesday, January 21, 2009

Forgery error while maintaining session in ruby on rails

hi guys recently i have tried pragmatic rails application depot. it was going good while the implementation apart from there were some changes because of i am working on the new version of rails 2.0.2
as soon as i have reached to store session the application have started giving me a stupid error (frogery error). it was just refusing me to pass explicit session. then i came to know that button_to or link_to creates its own session and passes this session to the controller.
for avoiding this crap i have just followed the steps

go to depot/config/environment.rb and uncomment this,

config.action_controller.session_store = :active_record_store

go to depot/app/controller/application.rb and uncomment the following

protect_from_forgery :secret => '165451f36fafd3eba6cd953bbcb6daf0'

now just restarted my server this went fine.

hope this will help you.
cheers