Plugin init.rb help

Hi,

I have created a plugin that has the following code in the init.rb
ActionController::Base.send :include, PersonaliseSite

The PersonaliseSite module has a class which_country that returns ‘uk’
as a string.

Which means I can sucessfully do somthing like this in my users
controller

#
# render new.rhtml
def new
   @user = User.new
   @user.country = which_country
end

However whenever I pass which_country into the following line of code
record_select :per_page => 10,
:search_on => ‘full_name’,
:order_by => “field(country, #{which_country})”

I get a undefined local variable or method `which_country’ for
UsersController:Class error.

Has anyone any suggestions on what is going on and why it can access the
value within a method but not within the above code

thanks
scott

Scott :

However whenever I pass which_country into the following line of code
record_select :per_page => 10,
:search_on => ‘full_name’,
:order_by => “field(country, #{which_country})”

I get a undefined local variable or method `which_country’ for
UsersController:Class error.

Has anyone any suggestions on what is going on and why it can
access the value within a method but not within the above code

Maybe because you should have a instance method called
which_country and also a class method called which_country.

-- Jean-François.