[Rails] Please advise on render:partial form.
Background:
On my application users can post Castings [class Casting] now i want
other users to be abel to post Comments on the Castings
[Castingcomment].
Approach:
views/castings/show.html.erb '
<%= render :partial => 'castingcomment_form' %>
app/controllers/castingcomments_controller.rb
def create
@castingcomment = Castingcomment.new( params[:castingcomment] )
if @castingcomment.save
redirect_to :controller => "castings", :action => "show", :id =>
@castingcomment.casting_id
else
# what to write here ?
end
end
The problem:
When the form validates it all works, but if create goes to a error
what to write there ? I need to render the same page (views/casting/
show.html.erb) again to show the error to the user.
Please advice me, i have been looking at this for hours.
/Niklas.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home