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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -