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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
OK - at least I have a workaround.... removing the constraints allows link_to, etc to work. However, I have to deal with checking for properly formatted URL''s in the controller. Alan On Jun 18, 2:24 pm, Alan McCann <alanmcc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.