“please help me immediately” is rude. You think people say “oh i
know the answer but i will wait with the answer for 3 days?” People
will help if they can.
<%= text_field “movie”, “id” %>
will compile to:
(look at your generated HTML)
so your parameter is params[:movie][:id] and NOT params[:id]
as i already said, it is not params[:id], it’s params[:movie][:id]
so, as i already said, try Movie.find(params[:movie][:id])
you don’t need the @movie.id value. if it’s not there, it won’t be
filled in the text_field, but that’s fine. it’s just part of how the
FormTagHelpers build the Tags.
look at your generated HTML
“please help me immediately” is rude. You think people say “oh i
know the answer but i will wait with the answer for 3 days?” People
will help if they can.
<%= text_field “movie”, “id” %>
will compile to:
(look at your generated HTML)
so your parameter is params[:movie][:id] and NOT params[:id]
that will have the same result, plus it gives you the advantages of AR
collections, which find_by_sql doesn’t
Dear Thorsten,
Thx for ur help. But I do not have @movie.id value.
I just take a input for the movie id and search the id in the “movies”
table
so i can not use it.
I also try to use Movie.find(params[:id]) but error return as id is
null.
please try to understand my question.