Rails helper_method with argument -
when allowing controller methods helper in views, how pass argument?
in example_controller.rb have
class examplecontroller < applicationcontroller helper_method :group_exists? private def group_exists?(gid): .. code check if group exists end end in view (i use slim), want pass argument
- if group_exists?(group.gid) | exists - else | not exist however throws error saying
wrong number of arguments (2 0..1)
buddy if want helper method, there place defined it. write same method in examplehelper class created you.
the reason if want debug helper, know easily. don't create helpers in controller until use case specially call it.
Comments
Post a Comment