开发者

Rails 3 Gem Include

开发者 https://www.devze.com 2023-03-23 13:22 出处:网络
开发者_运维知识库I have made this gem: https://github.com/RLovelett/feedzirra-rails I want to be able to include it like: gem \"feedzirra-rails\", :git => \"git://github.com/RLovelett/feedzirra-rai

开发者_运维知识库I have made this gem: https://github.com/RLovelett/feedzirra-rails I want to be able to include it like: gem "feedzirra-rails", :git => "git://github.com/RLovelett/feedzirra-rails.git", :branch => "feedzirra-rails"

However, Rails does not seem to be extending ActiveRecord::Base automatically. Though, if I call require "feedzirra_rails" inside of a model that uses acts_as_feed everything is fine.

Basically, I don't want to have to call require. I just want acts_as_feed available to all models automatically.

Suggestions?


You need to add a railtie to the gem. This will make it load automatically when you include the gem in your Gemfile. Make sure you require the railtie in lib/feedzirra.rb

http://api.rubyonrails.org/classes/Rails/Railtie.html

0

精彩评论

暂无评论...
验证码 换一张
取 消