rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

How use helper method in lambda function? #508

Closed amir-biybulatov closed 4 years ago

amir-biybulatov commented 4 years ago

Checklist

My Environment

Software Version
Operating System MacOS 10.15.3
Jets 2.3.16
Ruby 2.7.0

Expected Behaviour

I am going to use helper method in lambda function. I have added include ApplicationHelper in app/functions/my_function.rb

Current Behavior

But I am getting the error - uninitialized constant ApplicationHelper

Code Sample

app/functions/my_function.rb

include ApplicationHelper
def lambda_handler(event:, context:)
  puts event
  puts context

  # get_event_details is defined in ApplicationHelper
  details = get_event_details(event) 
end

app/helpers/application_helper.rb

module ApplicationHelper
   def get_event_details(event)
      #code
   end
end
amir-biybulatov commented 4 years ago

Hi @tongueroo Yes, sorry this is a question, not a bug. I have asked this question here on Jets community. Can you please help me? Thank you.