Topic: statically calling methods

I have a method in my Street Model.


class Street < ActiveRecord::Base

  def self.prefix_list(index)
    list = ['North', 'South', 'East', 'West' ]
    if index.nil? then list else list[index] end


I want to call upon it.


<%= select :street, :suffix, Street.suffix_list.collect {|p| [, ] } %>

In C++ I was able to statically call methods.
How do you do this in ruby?

Last edited by OmenKing (2007-06-01 21:15:08)

Re: statically calling methods

That should work, if you give the method the same name (prefix/suffix, you need to choose one). smile

Do you still get an error?

Railscasts - Free Ruby on Rails Screencasts