ruby on rails - link_to, view, controller -
ruby on rails - link_to, view, controller -
i implemented link:
view:
<li><%= link_to "trainer-sportler", :controller => "trainerones", :action => "trspmatch" %></li>
controller:
def trspmatch render :trspmatch end
and 1 view trspmatch.html.erb
rails says:
unknown action action 'show' not found traineronescontroller
when implemented def show end , create show.html.erb. rails opens show.html.erb not trspmatch.html.erb?
you want define trainerones resource this:
resources :trainerones collection 'trspmatch' end end
that expose url /trainerones/trspmatch maps traineronescontroller#trspmatch. seems @ this link help understand routes better.
in case, benefit lot running rake routes
in console, display routes , how map controllers methods. seek before , after rewriting trainerones resource explained above, , you'll see difference. luck!
ruby-on-rails view link-to
Comments
Post a Comment