I've got STI like this:
class Post
end
class Post::Confirmed < Post
end
class Post::Draft < Post
def confirm!
becomes Post::Confirmed
end
end
...# somewhere in controller
# POST /posts/1/confirm
# POST /posts/1/confirm.json
def confirm
@post = Post::Draft.first
@post = @post.confirm! # this is the only way I can reload @post with Post::Confrmed
end
Is it somehow possible to make:
@post.confirm! # I want this @post(Post::Draft) to become Post::Confirmed without reassigning
Or is it just nor RoR way?
Thanks in advance!