-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make this gem even better by adding docs for integrating with rails #7
Comments
Hey, thanks! That's a great idea. So I did it! |
Excellent thank you! Two notes:
if Rails.env.development?
Rails.application.config.to_prepare do
Dir[File.join(Rails.root, 'app', 'bots', '*.rb')].each do |f|
bot_name = File.basename(f, File.extname(f)).camelize
bot_name.constantize unless Object.const_defined?(bot_name)
end
end
end
end |
Right – I was thinking
Woa, yeah! You're right, of course. That would be really difficult and annoying to debug for anyone who isn't familiar with how eager loading in Rails (like me, apparently). That initializer is pretty elaborate, but unless there's an easier way to tell Rails to eager load only a given path in development I think it's probably the best we can do, right? |
I've spent quite some time looking at how ActiveSupport works writing this gem. To date I haven't found a better way to do eager loading in development mode. Sometimes there are sneaky more elegant ways of doing it like what we did here. I'll make a pull request that loads a Railtie only if Rails is present and not in production mode. It's just going to take a while as I can only start in a week or so. |
Cool, thanks! I might even beat you to it, then. |
ee237c7 should do the trick, right? |
Are there some guide on how to do this with Rails? Thank you. |
This looks like the best facebook messenger bot api for ruby. To make it even better I suggest you include examples of how to use it within Rails. Perhaps how to mount the rack application within your rails app and where to place your ruby files that handle bot events (even though they can place it anywhere, they want to know what the standard most elegant place is). A simple controller as used in this gem seems nice: https://github.com/jun85664396/messenger-bot-rails
The text was updated successfully, but these errors were encountered: