Rails polymorphic assosication - on validation error render parent show action with flash message?

Building the path from the commentable class is generally what I would do In fact, you can build the path route helper name and then send that to the controller path = "edit_"+commentable.class. To_s.dasherize. Downcase+"_path send(path.

Intern).

Building the path from the commentable class is generally what I would do. In fact, you can build the path route helper name and then send that to the controller path = "edit_"+commentable.class. To_s.dasherize.

Downcase+"_path send(path. Intern).

I need to load the commentable object and then render the show page for it... aka take them back to the display page for the article they tried to comment on, display the flash error message, and still have the original value they tried to enter. For the non polymorphic version I could do: @article = @comment. Article render 'article/show' – SWR Jan 20 '10 at 0:15.

There is a polymorphic association between articles/profiles and comments called commentable. On success creating a new comment I return to the commentable parent object with a sucess flash and I would like to do the same with the appropriate error flash on validation errors. What should I pass to render?

I guess I could build the path by grabbing the commentable class name and lowercasing it... but that seems awkward.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions