[Rails] Re: Rails 3 constraints, named routes and form_tag
FYI:
What I am trying to do is create a form to select a location in the
book and then render it.
Thanks!
On Jun 18, 2:24 pm, Alan McCann <alanmcc...@gmail.com> wrote:
> I have the following URL I match to show a subset of text from a book
>
> /bookname/chapter1/line1/chapter2/line2
>
> I have a route definition that works perfectly when entering a url in
> the browser however I cannot get a link_to or path name for this url
>
> match '/:book/:chapter1/:line1/:chapter2/:line2',
> :to => "lines#showlines",
> :constraints => {
> :book => /\d*\s?\w{2,}/,
> :chapter1 => /\d+/,
> :line1 => /\d+/,
> :chapter2 => /\d+/,
> :line2 => /\d+/ },
> :as => :showlines
>
> I keep getting the error
> No route matches
> {:chapter1=>"1", :verse1=>"1", :controller=>"verses", :chapter2=>"1", :action=>"showverses", :verse2=>"3", :book=>"john"}
>
> I have tried
>
> <%=h link_to("link",
> showlines_path(:book=>'john',:chapter1=>'1',:chapter2=>'1',:line1=>'1',:line2=>'3'))
> %>
>
> This is Rails 3.
>
> Any pointers?
> Thanks!
--
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