Rails: i have a class method and i want to modify something of the instance
Posted
by Totty
on Stack Overflow
See other posts from Stack Overflow
or by Totty
Published on 2010-06-01T22:09:44Z
Indexed on
2010/06/01
22:13 UTC
Read the original article
Hit count: 103
Rails: i have a class method and i want to modify something of the instance
something like this:
class Test < Main
template :box
def test
# here I want to access the template name, that is box
end
end
class Main
def initialize
end
def self.template(name)
# here I have to save somehow the template name
# remember is not an instance.
end
end
that is similar to the model classes:
# in the model
has_many :projects
How do I do it?
© Stack Overflow or respective owner