Instead of:
#Do Something...
end
end
Do:
after_initialize :do_something
#Do Something...
end
end
Update 13/06/07:
Using named callbacks better conveys your intention, making your code more readable.
Similar article on The Rails Way
class MyClass
def after_initialize
#Do Something...
end
end
class MyClass
after_initialize :do_something
def do_something
#Do Something...
end
end
No comments:
Post a Comment