Friday, January 27, 2012

[Rails] Re: Redirecting to create new page with input

Thanks for your explanation. It is exactly what I wanted.

in search.html.erb, I added

<%= link_to('RegisterThisMovie', {:controller => 'video', :action =>
'new', :url => y }) %>

'y' contains the url of the movie after executing the search.

in video_controller.rb, I added

def new
@video = Video.new
@video.url = params[:url] #<---HERE
respond_to do |format|
format.html # new.html.erb
format.json { render json: @video }
end
end

then it worked fine!
Thanks for your help.

soichi

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate