1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

12 commits

Author SHA1 Message Date
thedarkone
7cee1587f1 options[:action] is very likely to be nil. 2010-09-27 17:45:59 +02:00
Piotr Sarnacki
2607def862 Use new ActiveModel::Naming.route_key in polymorphic_routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
706a3223a3 Add short note on using url_for instead of directly calling named route in polymorphic_url 2010-09-03 22:59:14 +02:00
Piotr Sarnacki
613cbe1f00 Add possibility to explicitly call engine's routes through polymorphic_routes, for example: polymorphic_url([blog, @post]) 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
8ec2175aee Added more tests for polymorphic_url with namespaced models and implemented missing use cases 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
8fb9df535e Modified polymorphic_url to check for model's namespace
This change allows using namespaced models with polymorphic_url,
in the way that you would use them without namespace.

Let's say that you have Blog::Post model in namespaced Engine. When you use
polymorphic_path with Blog::Post instances, like in form_for(@post),
it will look for blog_posts_path named url helper. As we are inside Blog::Engine,
it's annoying to always use the prefix. With this commit, blog_ prefix will be
removed and posts_path will be called.
2010-09-03 22:59:12 +02:00
Piotr Sarnacki
b53efd2105 Extended url_for to handle specifying which router should be used.
A few examples:
url_for Blog::Engine, :posts_path
url_for Blog::Engine, @post
url_for Blog::Engine, :action => "main", :controller => "index"
2010-09-03 22:59:06 +02:00
Xavier Noria
3805d01c9b resolves merge conflict 2010-08-31 00:24:05 +02:00
Joost Baaij
591e87fe7b Expanded routing documentation with current best practices 2010-08-29 00:04:14 +02:00
yury
3e22e0b025 Micro optimization for build_named_route_call in PolymorphicRoutes:
1. use map instead of inject
2. use [].join("_") instead of '<<'. It is a little bit faster for ruby 1.9.2 and x2 faster for ruby 1.8.7. http://gist.github.com/548143

[#5450 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:54:50 -03:00
Piotr Sarnacki
6807b08099 Moved a few methods from RecordIdentifier to ActiveModel::Naming
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-21 11:29:58 +02:00
Piotr Sarnacki
a63566dda8 Moved PolymorphicRoutes to ActionDispatch::Routing
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-20 23:12:46 +02:00