Ruby on Rails Saturday, January 28, 2012

On Fri, Jan 27, 2012 at 23:14, Soichi Ishida <lists@ruby-forum.com> wrote:

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

Great! Now let's take it to the next level. I think you can make it
a little more "canonical". Instead of:

>  <%= link_to('RegisterThisMovie', {:controller => 'video', :action =>
> 'new', :url => y }) %>
>
> 'y' contains the url of the movie after executing the search.

try:

<%= link_to( 'Register This Movie', new_video_path, :url => y ) %>

Also you can try getting used to the newer hash syntax, and do:

<%= link_to( 'Register This Movie', new_video_path, url: y ) %>

I'm not 100% sure off the top of my head that these will work, but it
should be at least close. :*) The built-in url helpers like
new_whatever_path, edit_whatever_path(some_object), etc. will save you
lots of typing and thus errors.

-Dave

--
Dave Aronson:  Available Cleared Ruby on Rails Freelancer
(NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at
www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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.

No comments:

Post a Comment