Hi Merb-peeps,
Consider this rails-esque create action from an Article resource
controller:
def create(article)
@article = Article.new(article)
if @article.save
case content_type
when :xml
display @article, :status => 201, :location => resource(@article)
else
redirect resource(@article), :message => { :notice => "Article
was successfully created" }
end
else
case content_type
when :xml
display @article.errors, :status => 422
else
message[:error] = "Article failed to be created"
render :new
end
end
end
Everything works nicely except for:
display @article.errors
The display method attempts to call to_xml on the ValidationError
object, but it is not implemented by the dm-serializer gem.
Is this an oversight of dm-serializer, or am I missing the merbful way
of doing this?
Best,
Josh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---