Mariano Kamp
2006-Mar-25 15:52 UTC
[Rails] Rails Plugins: Why to register your own functionality with send()?
Hi there, I have seen in the file column plugin ( http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak or David''s acts_as_taggable plugin that to register my functionality I need to do something like this: ApplicationHelper.send(:include, InPlaceEditAssociations) I am wondering why not: (a) module ApplicationHelper include InPlaceEditAssociatons end or: (b) ApplicationHelper.include(InPlaceEditAssociations) As I now know a way that works this is not crucial to me, but I am still curious. Cheers, Mariano -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060325/d29f44dc/attachment.html
Mariano Kamp
2006-Mar-25 16:15 UTC
[Rails] Re: Rails Plugins: Why to register your own functionality with send()?
Grmpfh. Sorry, forgot to mention something: a) results in the methods from my module being available in the ApplicationHelper directly after my definition but not when accessed from a view. b) results in a error message saying that I tried to call a private method. On 3/25/06, Mariano Kamp <mariano.kamp@gmail.com> wrote:> > Hi there, > > I have seen in the file column plugin ( > http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak or > David''s acts_as_taggable plugin that to register my functionality I need to > do something like this: > > ApplicationHelper.send(:include, InPlaceEditAssociations) > > I am wondering why not: > > (a) > module ApplicationHelper > include InPlaceEditAssociatons > end > > or: > > (b) > ApplicationHelper.include (InPlaceEditAssociations) > > As I now know a way that works this is not crucial to me, but I am still > curious. > > Cheers, > Mariano >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060325/6e7ab091/attachment-0001.html
joey__
2006-Mar-26 08:10 UTC
[Rails] Re: Rails Plugins: Why to register your own functionality wi
Mariano Kamp wrote:> Hi there, > > I have seen in the file column plugin ( > http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak > or > David''s acts_as_taggable plugin that to register my functionality I need > to > do something like this: > > ApplicationHelper.send(:include, InPlaceEditAssociations) > > I am wondering why not: > > (a) > module ApplicationHelper > include InPlaceEditAssociatons > end > > or: > > (b) > ApplicationHelper.include(InPlaceEditAssociations) > > As I now know a way that works this is not crucial to me, but I am still > curious. > > Cheers, > MarianoWith send you can call private methods so, ApplicationHelper.send(:include, InPlaceEditAssociations) is ApplicationHelper.include(InPlaceEditAssociations) except it doesn''t matter that the method is private. joey__ -- Posted via http://www.ruby-forum.com/.
Mariano Kamp
2006-Mar-30 04:59 UTC
[Rails] Re: Rails Plugins: Why to register your own functionality wi
Hey Joey, thanks. I am wondering what is the point of making a method private then? To give an indication that this method is not supposed to be called from the outside? Cheers, Mariano On 3/26/06, joey__ <cardologist@gmail.com> wrote:> > Mariano Kamp wrote: > > Hi there, > > > > I have seen in the file column plugin ( > > http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak > > or > > David''s acts_as_taggable plugin that to register my functionality I need > > to > > do something like this: > > > > ApplicationHelper.send(:include, InPlaceEditAssociations) > > > > I am wondering why not: > > > > (a) > > module ApplicationHelper > > include InPlaceEditAssociatons > > end > > > > or: > > > > (b) > > ApplicationHelper.include(InPlaceEditAssociations) > > > > As I now know a way that works this is not crucial to me, but I am still > > curious. > > > > Cheers, > > Mariano > > With send you can call private methods so, > ApplicationHelper.send(:include, InPlaceEditAssociations) is > ApplicationHelper.include(InPlaceEditAssociations) except it doesn''t > matter that the method is private. > > joey__ > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060330/324a58bd/attachment.html
Seemingly Similar Threads
- Does TMail support Nested Multipart Messages? (Repost)
- Why does''nt rails pick up more metadata from a mysql schema?
- Rails vs. J2EE: Sharing state in memory?
- Rails Plugins: How to copy artefacts to the public directory during install? When is install.rb executed anyway?
- How to debug the rendering in Rails?