Hi, I've got something like this
class Reply < AR::Base
end
class VideoReply < Reply
def hello
p 'not ok'
end
end
class PostReply < Reply
def hello
p 'ok'
end
end
...
So when I am creating object:
# params[:reply][:type] = "VideoReply"
@reply = Reply.new(params[:reply])
How can I invoke child method (in this case VideoReply::hello
)?
UPD: I can imagine only very stupid solution:
@reply = Reply.new(params[:reply])
eval(@reply.type).find(@reply.id).hello
But it is not cool, I think :)