Hey guys!Ihave a problem with a nested resource: when i subbmit the
new page i receive:No action responded to create
the controller :
def create
@entry = @user.entries.new(params[:entry])
respond_to do |format|
if @entry.save
flash[:notice] = ‘Entry was successfully created.’
format.html { redirect_to([@user, @entry]) }
format.xml { render :xml => @registration,
:status => :created,
:location => [ @user, @entry ] }
else
format.html { render :action => “new” }
format.xml { render :xml => @entry.errors,
:status => :unprocessable_entity }
end
end
end
routes.rb:
map.resources :users, :member => { :enable => :put } do |users|
users.resources :roles
users.resources :entries do |entry|
entry.resources :comments
end
end
new entry view:
New Blog Entry
<%= error_messages_for :entry %>
<% form_for(:entry, :url => user_entries_path) do |f| %>
Title:
<%= f.text_field :title, :size => 40 -%>
Blog Entry:
<%= f.text_area :body, :rows => 10, :cols => 60 -
%>
<%= f.submit "Create" %>
<% end %><%= link_to ‘Back’, user_entries_path(@user) %>
please heeeelp!!!