Do I understand correctly that you can''t write controller plugins? Of course "can''t" is a big word, what I''m really wondering is what the major stumbling blocks to doing so are? Am I missing something or wouldn''t this be extremely useful? Thanks! Tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/16/07, tmac <mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Do I understand correctly that you can''t write controller plugins? > > Of course "can''t" is a big word, what I''m really wondering is what the > major stumbling blocks to doing so are? > > Am I missing something or wouldn''t this be extremely useful?googling rails controller plugin got me here http://wiki.rubyonrails.org/rails/pages/Controller+Extensions in short order. Plugins are just code. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I was reading this article: http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i to quote: "Controllers: You can''t directly write a controller plugin, but you can write a generator that copies a controller to your app/controllers directory. Intermediate difficulty." ??? Tim On Oct 16, 11:51 am, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Do I understand correctly that you can''t write controller plugins? > > > Of course "can''t" is a big word, what I''m really wondering is what the > > major stumbling blocks to doing so are? > > > Am I missing something or wouldn''t this be extremely useful? > > googling > rails controller plugin > > got me herehttp://wiki.rubyonrails.org/rails/pages/Controller+Extensions > in short order. > > Plugins are just code. > > -- > Rick DeNatale > > My blog on Rubyhttp://talklikeaduck.denhaven2.com/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Outside of me being unable to really understand what "controller plugin" means in the quote, the article is from over a year ago. If you''re trying to add macros or what not to controllers, you simply do: ActionController::Base.send(:include, MyModuleOfMethods) in your plugin/init.rb What are you trying to do tmac? Jason On 10/16/07, tmac <mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I was reading this article: > > http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i > > to quote: > > "Controllers: You can''t directly write a controller plugin, but you > can write a generator that copies a controller to your app/controllers > directory. Intermediate difficulty." > > ??? > > Tim > On Oct 16, 11:51 am, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Do I understand correctly that you can''t write controller plugins? > > > > > Of course "can''t" is a big word, what I''m really wondering is what the > > > major stumbling blocks to doing so are? > > > > > Am I missing something or wouldn''t this be extremely useful? > > > > googling > > rails controller plugin > > > > got me herehttp://wiki.rubyonrails.org/rails/pages/Controller+Extensions > > in short order. > > > > Plugins are just code. > > > > -- > > Rick DeNatale > > > > My blog on Rubyhttp://talklikeaduck.denhaven2.com/ > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think that''s pretty much the answer I was hoping for Jason! So the article is wrong and yes you can write controller plugins... thought that was odd! I have a site/project where I use a controller base class that handles all the standard REST methods (new, show, edit, etc...) in a fairly generic way. It would certainly take some work but I thought it might be nice to share it as a plugin... at least for my own projects, and others if there is any interest. I have looked a bit but haven''t seen anything like it. Is there a plugin that already does something similar? Thanks a ton Jason! Tim On Oct 16, 12:27 pm, "Jason Roelofs" <jameskil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Outside of me being unable to really understand what "controller plugin" > means in the quote, the article is from over a year ago. > > If you''re trying to add macros or what not to controllers, you simply do: > > ActionController::Base.send(:include, MyModuleOfMethods) > > in your plugin/init.rb > > What are you trying to do tmac? > > Jason > > On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I was reading this article: > > >http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rail... > > > to quote: > > > "Controllers: You can''t directly write a controller plugin, but you > > can write a generator that copies a controller to your app/controllers > > directory. Intermediate difficulty." > > > ??? > > > Tim > > On Oct 16, 11:51 am, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Do I understand correctly that you can''t write controller plugins? > > > > > Of course "can''t" is a big word, what I''m really wondering is what the > > > > major stumbling blocks to doing so are? > > > > > Am I missing something or wouldn''t this be extremely useful? > > > > googling > > > rails controller plugin > > > > got me herehttp://wiki.rubyonrails.org/rails/pages/Controller+Extensions > > > in short order. > > > > Plugins are just code. > > > > -- > > > Rick DeNatale > > > > My blog on Rubyhttp://talklikeaduck.denhaven2.com/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Tim Have you taken a lookat activescaffold ? Imanot sure towhat extentisit RESTful... On Oct 17, 3:46 am, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think that''s pretty much the answer I was hoping for Jason! So the > article is wrong and yes you can write controller plugins... thought > that was odd! > > I have a site/project where I use a controller base class that handles > all the standard REST methods (new, show, edit, etc...) in a fairly > generic way. It would certainly take some work but I thought it might > be nice to share it as a plugin... at least for my own projects, and > others if there is any interest. > > I have looked a bit but haven''t seen anything like it. Is there a > plugin that already does something similar? > > Thanks a ton Jason! > Tim > > On Oct 16, 12:27 pm, "Jason Roelofs" <jameskil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Outside of me being unable to really understand what "controller plugin" > > means in the quote, the article is from over a year ago. > > > If you''re trying to add macros or what not to controllers, you simply do: > > > ActionController::Base.send(:include, MyModuleOfMethods) > > > in your plugin/init.rb > > > What are you trying to do tmac? > > > Jason > > > On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I was reading this article: > > > >http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rail... > > > > to quote: > > > > "Controllers: You can''t directly write a controller plugin, but you > > > can write a generator that copies a controller to your app/controllers > > > directory. Intermediate difficulty." > > > > ??? > > > > Tim > > > On Oct 16, 11:51 am, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Do I understand correctly that you can''t write controller plugins? > > > > > > Of course "can''t" is a big word, what I''m really wondering is what the > > > > > major stumbling blocks to doing so are? > > > > > > Am I missing something or wouldn''t this be extremely useful? > > > > > googling > > > > rails controller plugin > > > > > got me herehttp://wiki.rubyonrails.org/rails/pages/Controller+Extensions > > > > in short order. > > > > > Plugins are just code. > > > > > -- > > > > Rick DeNatale > > > > > My blog on Rubyhttp://talklikeaduck.denhaven2.com/- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 16 Oct 2007, at 20:46, tmac wrote:> > I think that''s pretty much the answer I was hoping for Jason! So the > article is wrong and yes you can write controller plugins... thought > that was odd!Yes and no. What the article is saying is that you can''t have foo_controller in your plugin, install your plugin and then try to access http://myapp.com/foo I think that there is stuff afoot so that you can specify the paths searched for views & controllers, but out of the box it won''t work. What you can of course do is a generator, provide modules for controllers or extend ActionController with macros and so on. Fred> > I have a site/project where I use a controller base class that handles > all the standard REST methods (new, show, edit, etc...) in a fairly > generic way. It would certainly take some work but I thought it might > be nice to share it as a plugin... at least for my own projects, and > others if there is any interest. > > I have looked a bit but haven''t seen anything like it. Is there a > plugin that already does something similar? > > Thanks a ton Jason! > Tim > > On Oct 16, 12:27 pm, "Jason Roelofs" <jameskil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Outside of me being unable to really understand what "controller >> plugin" >> means in the quote, the article is from over a year ago. >> >> If you''re trying to add macros or what not to controllers, you >> simply do: >> >> ActionController::Base.send(:include, MyModuleOfMethods) >> >> in your plugin/init.rb >> >> What are you trying to do tmac? >> >> Jason >> >> On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >>> I was reading this article: >> >>> http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to- >>> rail... >> >>> to quote: >> >>> "Controllers: You can''t directly write a controller plugin, but you >>> can write a generator that copies a controller to your app/ >>> controllers >>> directory. Intermediate difficulty." >> >>> ??? >> >>> Tim >>> On Oct 16, 11:51 am, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> wrote: >>>> On 10/16/07, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>>>> Do I understand correctly that you can''t write controller plugins? >> >>>>> Of course "can''t" is a big word, what I''m really wondering is >>>>> what the >>>>> major stumbling blocks to doing so are? >> >>>>> Am I missing something or wouldn''t this be extremely useful? >> >>>> googling >>>> rails controller plugin >> >>>> got me herehttp://wiki.rubyonrails.org/rails/pages/Controller >>>> +Extensions >>>> in short order. >> >>>> Plugins are just code. >> >>>> -- >>>> Rick DeNatale >> >>>> My blog on Rubyhttp://talklikeaduck.denhaven2.com/ > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/17/07, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 16 Oct 2007, at 20:46, tmac wrote: > > > > > I think that''s pretty much the answer I was hoping for Jason! So the > > article is wrong and yes you can write controller plugins... thought > > that was odd! > > Yes and no. What the article is saying is that you can''t have > foo_controller in your plugin, install your plugin and then try to > access http://myapp.com/foo > I think that there is stuff afoot so that you can specify the paths > searched for views & controllers, but out of the box it won''t work. > What you can of course do is a generator, provide modules for > controllers or extend ActionController with macros and so on.Hmmm, looks like you already can. Try adding your load paths to: * MyController.template_root * ActionController::Routing.controller_paths * Dependencies.load_paths Demo: $ cat vendor/plugins/test_plugin/init.rb config.after_initialize do path = File.expand_path(''app/controllers'', File.dirname(__FILE__)) ActionController::Routing.controller_paths << path Dependencies.load_paths << path end $ cat vendor/plugins/test_plugin/app/controllers/test_plugin_controller.rb class TestPluginController < ApplicationController self.template_root = File.expand_path(''../views'', File.dirname(__FILE__)) def test end end $ cat vendor/plugins/test_plugin/app/views/test_plugin/test.rhtml hi $ script/console Loading development environment.>> app.get(''/test_plugin/test''); puts app.response.bodyhi => nil --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for setting me down the right path here guys... It appears to be relatively straight forward. CHH - I''m only vaguely familiar with activescaffold ... I was really trying to avoid a generator ... unless I''m misunderstanding they typically generate a lot of very similar code over and over ... this is for more than just admin stuff too:-) I really just want to be able to inherit functionality into my controllers. Tim On Oct 17, 6:57 am, George <george.og...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/17/07, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > On 16 Oct 2007, at 20:46, tmac wrote: > > > > I think that''s pretty much the answer I was hoping for Jason! So the > > > article is wrong and yes you can write controller plugins... thought > > > that was odd! > > > Yes and no. What the article is saying is that you can''t have > > foo_controller in your plugin, install your plugin and then try to > > accesshttp://myapp.com/foo > > I think that there is stuff afoot so that you can specify the paths > > searched for views & controllers, but out of the box it won''t work. > > What you can of course do is a generator, provide modules for > > controllers or extend ActionController with macros and so on. > > Hmmm, looks like you already can. Try adding your load paths to: > > * MyController.template_root > * ActionController::Routing.controller_paths > * Dependencies.load_paths > > Demo: > > $ cat vendor/plugins/test_plugin/init.rb > config.after_initialize do > path = File.expand_path(''app/controllers'', File.dirname(__FILE__)) > ActionController::Routing.controller_paths << path > Dependencies.load_paths << path > end > > $ cat vendor/plugins/test_plugin/app/controllers/test_plugin_controller.rb > class TestPluginController < ApplicationController > self.template_root = File.expand_path(''../views'', File.dirname(__FILE__)) > def test > end > end > > $ cat vendor/plugins/test_plugin/app/views/test_plugin/test.rhtml > hi > > $ script/console > Loading development environment.>> app.get(''/test_plugin/test''); puts app.response.body > > hi > => nil--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---