Reputation: 427
i want to send a parameter "Sportler" to my new-action, there I want to create a new Object of this type.
You can see the error message below.
View:
<%= link_to 'New Sportsmen', :action => "new(:type => "Sportler")" %>
Controller: trainerones
def new
@trainerones = Person.new(:type => params[:type])
respond_to do |format|
format.html # new.html.erb
format.json { render json: @trainerones }
end
I get this:
G:/testmud/app/views/trainerones/show.html.erb:27: syntax error, unexpected tCONSTANT, expecting ')'
...ler', :action => "new("Sportler")" );@output_buffer.safe_con..
And the action is not callable with new_trainerones_path, where can i register this helper?
Now im using new.
Therefor i added: match 'trainerones/new' => 'trainerones#new'
Upvotes: 0
Views: 44
Reputation: 7304
Try
<%= link_to 'New Sportsmen', "/trainerones/new?type=Sportler" %>
Upvotes: 1