0

Here's the code:

class SyncController < ApplicationController
  def get_sync
    @passed_ids = params[:ids].split(',')
    @users = @passed_ids.collect{|id| User.find(id)}

    #add the current user to the list
    @users << current_user
    @recommendations = get_recommendations(@users)
  end
end

module SyncHelper
  def get_recommendations(users)
    users
  end
end

I'm getting a can't find get_recommendations method error...

locoboy
  • 38,002
  • 70
  • 184
  • 260
  • i think you'll find your answer here: http://stackoverflow.com/questions/453762/nomethoderror-when-trying-to-invoke-helper-method-from-rails-controller – heavysixer Jul 21 '12 at 19:54

1 Answers1

2

Your SyncHelper module needs to be included into your SyncController class. You can either add the line

include SyncHelper

in your class definition, or, if SyncHelper lives in the expected app/helpers file, you can use the rails helper method.

Mori
  • 27,279
  • 10
  • 68
  • 73