there is no new method...
just create... here's my reviews controller
class ReviewsController < ApplicationController
def create
@school = School.find(params[:school_id])
@review = @school.reviews.build(params[:review])
if @review.save
redirect_to @school
else
render :action => "new"
end
end
end
and here's my school show view...
<h1 id="school_name"><%=h @school.name %> (<%=h @school.place %>)</h1>
<h1 id="school_url"><%= link_to @school_url, @school.url %></h1>
<% form_for [...@school, Review.new] do |f| %>
<p>
<%= f.label :first_name, "First Name" %><br />
<%= f.text_field :first_name, :length => 40 %>
</p>
<p>
<%= f.label :body, "Leave a review..." %><br />
<%= f.text_area :body, :cols => 40, :rows => 6 %>
</p>
<p><%= f.submit "Add Review" %></p>
<% end %>
<% unless @school.reviews == [] %>
<div id="reviews">
<%= render :partial => @school.reviews %>
</div>
<% end %>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---