This is one of the things we're working out. The easiest thing to do is to put the Railtie subclass in lib/my_lib.rb itself. The bundler will require the file, similar to how config.gem worked in Rails 2.3.
Another option would be to move it into lib/my_lib/railtie.rb (or whatever) and require it from my_lib.rb. You can then do require "my_lib/railtie" if defined?(Rails), since the Rails constant will always be required before your gems (check out boot.rb if you want to see how). You could also ask your users to require my_lib/rails or :require_as => ["my_lib", "my_lib/rails"] in bundler. We're looking at some other, long-term options involving Rubygems metadata to further automate that process (perhaps you'd include some metadata in Rubygems registering your gem as a "plugin for rails >= 3.0 with lib/my_lib/railtie.rb" which would tell bundler to require that file, but only if Rails was around. Bottom line: there's a bunch of options right now, and the community should really converge on a few really good ones. I personally like putting the railtie in lib/my_lib.rb for gems that are only used as Rails plugins. Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 On Wed, Jan 20, 2010 at 1:39 AM, Mislav Marohnić <mislav.maroh...@gmail.com>wrote: > On Wed, Jan 20, 2010 at 04:45, Yehuda Katz <wyc...@gmail.com> wrote: > >> >> I am working on a blog post now, but the basic idea is that >> ActionController, ActiveRecord, etc. are all "plugins" now. So anything that >> they can do, you can do too. >> > > During the boot process, their respective "railtie.rb" scripts are > required. Should we also write and later require "railtie.rb" from our > plugins in application.rb, or will this be automatized ("railtie.rb" will > have some magic behavior)? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-c...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscr...@googlegroups.com<rubyonrails-core%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-c...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.