Forum: Ruby on Rails help creating plugin?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A81bd1818d1f945485c030f53aa886e4?d=identicon&s=25 Scott Sherwood (Guest)
on 2007-04-03 10:41
Hi,

I am attempting to put a plugin together for the first time and am
having a few problems gettign started.

I have generated the plugin dir's and have a file called
personalise_site.rb
Also I have placed require 'personalise_site' init.rb

How can I get make all methods I put inside module PersonaliseSite
available to all views?

Thanks,
Scott
Cb529c252699cead3322847f81738d54?d=identicon&s=25 Scott Sherwood (Guest)
on 2007-04-03 10:57
dont worry, came across this
ActionView::Base.send :include, PersonaliseSite

Scott

Scott Sherwood wrote:
> Hi,
>
> I am attempting to put a plugin together for the first time and am
> having a few problems gettign started.
>
> I have generated the plugin dir's and have a file called
> personalise_site.rb
> Also I have placed require 'personalise_site' init.rb
>
> How can I get make all methods I put inside module PersonaliseSite
> available to all views?
>
> Thanks,
> Scott
A99870c1391c39da2089649745965bda?d=identicon&s=25 Jean-François Trân (Guest)
on 2007-04-03 10:57
(Received via mailing list)
Hi Scott,

> I am attempting to put a plugin together for the first time and am
> having a few problems gettign started.
>
> I have generated the plugin dir's and have a file called
> personalise_site.rb
> Also I have placed require 'personalise_site' init.rb
>
> How can I get make all methods I put inside module PersonaliseSite
> available to all views?

In your init.rb :

require 'personalise_site'
ActionView::Base.send(:include, PersonaliseSite)

   -- Jean-François.

--
Ruby ( http://www.rubyfrance.org ) on Rails ( http://www.railsfrance.org
)
This topic is locked and can not be replied to.