Commit Graph

18326 Commits

Author SHA1 Message Date
Piotr Sarnacki
e6b93fa6db Removed deprecated router API from railties 2010-09-05 13:44:37 +02:00
Łukasz Strzałkowski
7c50454529 Test for recognizing routes with http method set 2010-09-05 13:44:37 +02:00
Łukasz Strzałkowski
8412886bdb Fixed about half of broken tests in routing_test 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
415bacd7bf Fixed almost all resources tests 2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
8659c5e657 Fixed url_for test
Added route which matches all: controller, action, id and format
2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
aac390204a Revert "Extended default route for match in tests - now it matches controller, action, id and format if given."
This reverts commit 05e9d0df0dea68ca4655aa8723c3ee69049fac78.
2010-09-05 13:44:36 +02:00
Łukasz Strzałkowski
7ff8a2040e Extended default route for match in tests - now it matches controller, action, id and format if given.
This fixes url_for tests
2010-09-05 13:44:36 +02:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
Santiago Pastorino
708ee9c5ac Make scoped reorder override previous applied orders
[5528 state:committed]
2010-09-05 08:28:11 -03:00
Nick Ragaz
16e078d908 failing test for reorder overriding default_scope
[5528]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:27:51 -03:00
Neeraj Singh
91fec0d24d order should always be concatenated.
order that is declared first has highest priority in all cases.

Here are some examples.

Car.order('name desc').find(:first, :order => 'id').name

Car.named_scope_with_order.named_scope_with_another_order

Car.order('id DESC').scoping do
  Car.find(:first, :order => 'id asc')
end

No special treatment to with_scope or scoping.

Also note that if default_scope declares an order then the order
declared in default_scope has the highest priority unless
with_exclusive_scope is used.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:13:42 -03:00
José Valim
f9c21ce658 Remove more deprecated behavior from plugins. 2010-09-04 01:11:22 +02:00
José Valim
6f194bb3a9 Small tidy up on Rails::Engine. 2010-09-04 00:52:07 +02:00
José Valim
23a9455962 This commit merges most of the work done by Piotr Sarnacki in his Ruby Summer of Code project.
His work brings several capabilities from app to engines, as routes, middleware stack, asset handling and much more. Please check Rails::Engine documentation for more refenrences.

Merge remote branch 'drogus/engines'
2010-09-04 00:31:43 +02:00
Piotr Sarnacki
c3c1a1e148 Do not use ActionController::Base.page_cache_extension in initialize to not load more ActiveSupport than we need 2010-09-04 00:07:38 +02:00
Piotr Sarnacki
9f0a1ae14e Optimize ActionDispatch::Static 2010-09-04 00:07:34 +02:00
Piotr Sarnacki
89bd715f6b Forgot to move that line to railtie on rebase 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
ffa2acad5c Fixed tests after rebase 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
9af189ac8f I've changed that test along the way, it should actually stay without changes 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
6c906bf591 Use default_scope in isolated Engines to not force user to scope his routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
b8d6dc3c84 Implemented RouteSet#default_scope, which allows to set the scope for the entire routes object 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
b43b686b02 engines_blank_point should always be the last initializer in Engine 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
a5e509d6b1 We should avoid creating additional initializers when we can, adding them makes boot process slower 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
bf1ac82cec Add some documantation on new route_key and param_key in ActiveModel::Naming 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
6f3119d3c2 Remove namespace for isolated namespaced models in forms 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
2607def862 Use new ActiveModel::Naming.route_key in polymorphic_routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
6e5aed057f Prepared ActiveModel::Naming to handle cases for namespaced isolated engines 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
34cd8a68b1 Add some more docs on polymorphic_url with routes proxy 2010-09-03 22:59:14 +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
16dcaf8368 Updated tests to use scope(:module => :engine_name) instead of namespace and updated mounted engine tests to actually use the namespacing 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
b1c66f060b Move RoutesProxy to separate file 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
e35c2043b1 Include all helpers from non-namespaced engines 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
98ab4ded37 Set only helpers_path on inherited hook in action_controller/railtie.rb and use helper(:all) just after that 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
00874a2009 This was used only to clear warning in ActionMailer tests, it shouldn't be done like that 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
e5af8b7d85 Moved ActionMailer and ActionController railties options to inherited hook
This change is needed, because we must take namespace into account and if
controller's/mailer's class is namespaced, engine's paths should be set
instead of application's ones.

The nice side effect of this is removing unneeded logic in
ActionController::Base.inherited - now the helpers_path should be set
correctly even for engine's controllers, so helper(:all) will always
include correct helpers.
2010-09-03 22:59:12 +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
8284fd3855 Get rid of static_paths method and instead configure paths for ActionDispatch::Static in initializers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
d812677277 We don't need to clear action_methods on inherited hook as they are cleaned on method_added hook 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
56ef192374 ActionMailer should not depend on ActionDispatch 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
f3c703a32f Refactor RoutesProxy to avoid using _with_routes in helpers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
434139f89f Documented mounted helpers 2010-09-03 22:59:12 +02:00
Piotr Sarnacki
1a161c75ed Document engine_name 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
2e4e1e7d0c Added documentation for namespaced Engine 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
db8a864e69 Add table_name_prefix to Engine's namespace automatically 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
a7c6fe4c2a Rename isolated_engine_for to namespace 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
79bd92b783 Refactor ActionMailer to not use hide_actions 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
4131a2d804 Move ActionController::Railties::RoutesHelpers and ActionMailer::Railties::RoutesHelper to AbstractController::Railties::RoutesHelpers 2010-09-03 22:59:11 +02:00
Piotr Sarnacki
32baa27892 Include routes helpers only for inherited classes in ActionMailer 2010-09-03 22:59:10 +02:00