Q:

Rails helper_method with argument

When allowing controller methods as helper in the views, how do you pass an argument?
In my example_controller.rb I have
class ExampleController < ApplicationController
  helper_method :group_exists?

  private
  def group_exists?(gid):
    .. code to check if group exists
  end
end

In the view (I use slim), I want to pass an argument
- if group_exists?(group.gid)
  | Exists
- else
  | Does not exist

However it throws an error saying
wrong number of arguments (2 for 0..1)

A:

Buddy if you really want a helper method, there is already a place defined for it. Just write the same method in ExampleHelper class already created for you. 
The reason for this is that if you want to debug the helper, you will know where to look very easily. Don't create helpers in controller until your use case specially call for it.

