Help creating plugin?


#1

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


#2

dont worry, came across this
ActionView::Base.send :include, PersonaliseSite

Scott

Scott S. 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


#3

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
)