I put it down to the fact that it’s really late and I’m tired and
probably need food.
I thought you were asking for a nice way to handle (what you call)
constants and it looks more like you just wanted to know how to
create a class method.
def self.find_by_type #body of your method
end
The ‘self’ makes it a class method so you can call
ConstantsModel.find_by_type()
Thanks guys… that’s what I needed but I’m still not happy, there must
be something easier than that… perhaps something like
ConstantsModel.find_by_? but I will have to create a method for each
“type” of constants… (perhaps it was not the best to call them
“constants” because they are not)
cheers,
Rath
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.