Topic: newbie module question

I'm trying to play with modules.  I have a file job_score.rb which lives in the controllers directory and contains:

module JobScore

  CONST = 'foo'
  def JobScore.compute_region
    return 'xxx'

I have the following lines in people_controller.rb (created by generating a scaffold):

      @person.region = JobScore::CONST
      @person.region = JobScore.compute_region

The first one assigns 'foo' to region.
The second line gives:

undefined method `compute_region' for JobScore:Module

RAILS_ROOT: C:/InstantRails/rails_apps/optin
Application Trace | Framework Trace | Full Trace

C:/InstantRails/rails_apps/optin/app/controllers/people_controller.rb:40:in `edit'

I seem to be missing something very basic.

Re: newbie module question

module JobScore
   class Job
      def compute_region

if you do it like that you can call the method like:

jobscore =
@person.region = jobscore.compute_region

However, I do not advice a construction like this. Handle it in your model, but since you are playing around with modules, it's ok. Aslong as you know it's not best practice wink