first: I promise I've read through every post regarding this topic, searched the whole web, but still don't know...
I have to models Trip (has_many) and Accomodation (belongs_to). Accomodations are nested in a Trip:
resources :trips do
resources :routes, :accomodations
end
The controller looks like that:
def new
@accomodation = Accomodation.new
end
def create
@accomodation = Accomodation.new(params[:accomodation])
if @accomodation.save
flash[:success] = "Accomodation created!"
redirect_to new_trip_accomodation_path(@trip)
else
render 'pages/home'
end
end
The form:
<%= form_for([@trip, @accomodation]) do |f| %>
<%= render 'shared/error_messages', :object => f.object %>
<div class="field">
<%= f.label :title, "Titel" %>
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :description, "Beschreibung" %>
<%= f.text_field :description %>
</div>
<div class="actions">
<%= f.submit "Create" %>
</div>
<% end %>
The form renders the correct html (as far as I can see):
<form accept-charset="UTF-8" action="/trips/51/accomodations" class="new_accomodation" id="new_accomodation" method="post">
Ok, so when I submit the form, nothing happens. When I look into the server log, I can see the get-request to render the new-Form. But no reaction on the submit... Is the form not submitting at all? Why? I have absolutely no idea.
What else did I try?
<%= form_for([@trip, @accomodation], :url => { :action => :create }, :method => :post) do |f| %>
Nothing.
<%= form_for([@trip, @accomodation], :url => { :action => :create }, :method => :post) do |f| %>
Nothing as well.
<%= form_for([@trip, @accomodation, @trip.accomodations.new]) do |f| %>
Forget it.
Can anybody help. Any clues where I could start diggin?
Thanks in advance!