DEV Community

danieloh
danieloh

Posted on

Helper Methods 1

Know to only refer to by :details (for url)

  • will work if I upload this to mydomain
(in route)
get "/movies/:id" => "movies#show", as: :details

<%= details_path(42) %>
<%= details_url(42) %> 

<form action="<%= movie_path(@the_movie.id) %>" method="post" data-turbo="false">
# focus on the movie_path(@the_movie.id) 


#simplify render
render template: "movies/show"
render "movies/new"
# can remove render altogether if the same as title (ie. def new)


#replace a href
<a href="<%= new_movie_path %>">New movie</a>  becomes
<%= link_to "Add a new movie", new_movie_path %>



Enter fullscreen mode Exit fullscreen mode

Top comments (0)