Ruby on Rails
Tuesday, October 6, 2015
correct. i am experimenting with polymorphic_path(resource) and eg polymorphic_url([blog, post]), but so far im not getting the result i want. i am having separate files and inherited models and also inherited controllers (those dont have eny defined actions yet)...but no go....
On Tue, Oct 6, 2015 at 12:13 PM, Dave Aronson <googlegroups.2.TRex@codosaur.us> wrote:
On Tue, Oct 6, 2015 at 12:07 PM, tom <tomabroad@gmail.com> wrote:
> its just pseudo-code.
>
> but if i leave the base resource in there, then it give me an /animal/id
> route which i dont want. i want either /tiger/id or lion/id
Then you need to know whether your animal is a tiger or lion (or bear
of course), and call the appropriate path helper. That kind of
messiness is exactly what inheritance (and other forms of
polymorphism) are great at solving.
--
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.com.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQijL3jK-BtREipAUeH-O46PYvbTjMD7M1vARBMhcGD8t%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMd%3DozDvqCPJyqSoH9y8BP%3DTMSFoe7dpc%2B1P9V%2B%3DFJpr5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment