Rails 3 helper methods not available in controllers even after explicitly including them -
fist of i'm newbie rails.
have in sessionscontroller:
def method sign_in 'user' end
and in sessionshelper:
def sing_in(user) ...... end
so googling , reading answers on stackoverflow let me try this:
including 'sessionshelper' sessionscontroller , tried put in 'applicationcontroller' this:
class applicationcontroller < actioncontroller::base protect_from_forgery include sessionshelper def handle_unverified_requests sign_out super end end
but i'm getting
nomethoderror : undefined method `sign_in' sessionscontroller:0x007eff2004fcd8
also few questions:
1) what's point/difference in putting few methods in heplers , few in controllers? security issue or what?
2) tried puting sign_in method in sessionscontroller read in stackoverflow methods defined in controllers can accessed in views. avoid problems in views used
helper_method
but still same nomethoderror
3) best , easy way access helper methods in controllers?
so going wrong.
i'm using rails 3.2.11 , ruby 2.0.0p0
looks typo: helper method 'sing_in' instead of 'sign_in'.
Comments
Post a Comment