In Rails 3, is it possible to have a plugin inside an engine? Adding the lib dir of the plugin to autoload_paths doesn''t seem to work. I can manage to load it by adding that path to $: and requiring the init.rb file, but I''m not sure that''s the correct approach. Thanks! -- 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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Reading through the source in railties/lib/rails/paths.rb, I found this: module MyEngine class Engine < Rails::Engine config.after_initialize do ::AppName::Application.config.paths.vendor.plugins.push File.expand_path(''../../vendor/plugins'', __FILE__) end end end Is that correct? If it is, then it begs the question, how do I access the app configuration without directly referencing it''s name (::AppName)? On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> wrote:> In Rails 3, is it possible to have a plugin inside an engine? > > Adding the lib dir of the plugin to autoload_paths doesn''t seem to > work. > > I can manage to load it by adding that path to $: and requiring the > init.rb file, but I''m not sure that''s the correct approach. > > Thanks!-- 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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Rails.application, I think On 04/02/2011, at 13:36, Ivan el Magnifico <jaidron.skyesey@gmail.com> wrote:> Reading through the source in railties/lib/rails/paths.rb, I found > this: > > module MyEngine > class Engine < Rails::Engine > config.after_initialize do > ::AppName::Application.config.paths.vendor.plugins.push > File.expand_path(''../../vendor/plugins'', __FILE__) > end > end > end > > Is that correct? If it is, then it begs the question, how do I access > the app configuration without directly referencing it''s name > (::AppName)? > > On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> > wrote: >> In Rails 3, is it possible to have a plugin inside an engine? >> >> Adding the lib dir of the plugin to autoload_paths doesn''t seem to >> work. >> >> I can manage to load it by adding that path to $: and requiring the >> init.rb file, but I''m not sure that''s the correct approach. >> >> Thanks! > > -- > 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-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
You can access it via `Rails.configuration` :) Or if you want to access via application instance, you can use `Rails.application.config` --- However, please note that this mailing list is reserved for core discussion only. Next time please ask question like this on rubyonrails-talk mailing list :) On 4 ก.พ. 2554, at 22:36, Ivan el Magnifico wrote:> Reading through the source in railties/lib/rails/paths.rb, I found > this: > > module MyEngine > class Engine < Rails::Engine > config.after_initialize do > ::AppName::Application.config.paths.vendor.plugins.push > File.expand_path(''../../vendor/plugins'', __FILE__) > end > end > end > > Is that correct? If it is, then it begs the question, how do I access > the app configuration without directly referencing it''s name > (::AppName)? > > On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> > wrote: >> In Rails 3, is it possible to have a plugin inside an engine? >> >> Adding the lib dir of the plugin to autoload_paths doesn''t seem to >> work. >> >> I can manage to load it by adding that path to $: and requiring the >> init.rb file, but I''m not sure that''s the correct approach. >> >> Thanks! > > -- > 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-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Of course, didn''t think of that. It appears to work beautifully, so I guess this is the correct approach. Thanks! On Feb 4, 9:36 am, Nicolas Sanguinetti <godf...@gmail.com> wrote:> Rails.application, I think > > On 04/02/2011, at 13:36, Ivan el Magnifico <jaidron.skye...@gmail.com> wrote: > > > > > > > > > Reading through the source in railties/lib/rails/paths.rb, I found > > this: > > > module MyEngine > > class Engine < Rails::Engine > > config.after_initialize do > > ::AppName::Application.config.paths.vendor.plugins.push > > File.expand_path(''../../vendor/plugins'', __FILE__) > > end > > end > > end > > > Is that correct? If it is, then it begs the question, how do I access > > the app configuration without directly referencing it''s name > > (::AppName)? > > > On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> > > wrote: > >> In Rails 3, is it possible to have a plugin inside an engine? > > >> Adding the lib dir of the plugin to autoload_paths doesn''t seem to > >> work. > > >> I can manage to load it by adding that path to $: and requiring the > >> init.rb file, but I''m not sure that''s the correct approach. > > >> Thanks! > > > -- > > 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-core@googlegroups.com. > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Spoke too soon without testing enough. It appears the plugin classes are loaded, but the init code is not. On Feb 4, 9:43 am, Ivan el Magnifico <jaidron.skye...@gmail.com> wrote:> Of course, didn''t think of that. It appears to work beautifully, so I > guess this is the correct approach. > > Thanks! > > On Feb 4, 9:36 am, Nicolas Sanguinetti <godf...@gmail.com> wrote: > > > > > > > > > Rails.application, I think > > > On 04/02/2011, at 13:36, Ivan el Magnifico <jaidron.skye...@gmail.com> wrote: > > > > Reading through the source in railties/lib/rails/paths.rb, I found > > > this: > > > > module MyEngine > > > class Engine < Rails::Engine > > > config.after_initialize do > > > ::AppName::Application.config.paths.vendor.plugins.push > > > File.expand_path(''../../vendor/plugins'', __FILE__) > > > end > > > end > > > end > > > > Is that correct? If it is, then it begs the question, how do I access > > > the app configuration without directly referencing it''s name > > > (::AppName)? > > > > On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> > > > wrote: > > >> In Rails 3, is it possible to have a plugin inside an engine? > > > >> Adding the lib dir of the plugin to autoload_paths doesn''t seem to > > >> work. > > > >> I can manage to load it by adding that path to $: and requiring the > > >> init.rb file, but I''m not sure that''s the correct approach. > > > >> Thanks! > > > > -- > > > 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-core@googlegroups.com. > > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > > For more options, visit this group athttp://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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Oh sorry, I saw some similar questions on this list, so I posted here. On Feb 4, 9:42am, Prem Sichanugrist <sikand...@gmail.com> wrote:> You can access it via `Rails.configuration` :) > > Or if you want to access via application instance, you can use `Rails.application.config` > > --- > > However, please note that this mailing list is reserved for core discussion only. Next time please ask question like this on rubyonrails-talk mailing list :) > > On 4 ก.พ. 2554, at 22:36, Ivan el Magnifico wrote: > > > > > > > > > Reading through the source in railties/lib/rails/paths.rb, I found > > this: > > > module MyEngine > > class Engine < Rails::Engine > > config.after_initialize do > > ::AppName::Application.config.paths.vendor.plugins.push > > File.expand_path(''../../vendor/plugins'', __FILE__) > > end > > end > > end > > > Is that correct? If it is, then it begs the question, how do I access > > the app configuration without directly referencing it''s name > > (::AppName)? > > > On Feb 4, 9:13 am, Ivan el Magnifico <jaidron.skye...@gmail.com> > > wrote: > >> In Rails 3, is it possible to have a plugin inside an engine? > > >> Adding the lib dir of the plugin to autoload_paths doesn''t seem to > >> work. > > >> I can manage to load it by adding that path to $: and requiring the > >> init.rb file, but I''m not sure that''s the correct approach. > > >> Thanks! > > > -- > > 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-core@googlegroups.com. > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://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-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Seemingly Similar Threads
- Why does 'extend ActiveSupport::Concern' cause `undefined method 'recycle!'`?
- Rails 3.1 Engines: Full vs. Mountable
- Couldn't reload a module when it's changed. Tried :require_dependency, :watchable_dirs, :unloadable
- Custom init. of ActiveRecord objects - best practices
- config.after_initialize and development mode