Commit Graph

59 Commits

Author SHA1 Message Date
Jose and Yehuda
56cdc81c08 Remove default match without specified method
In the current router DSL, using the +match+ DSL
method will match all verbs for the path to the
specified endpoint.

In the vast majority of cases, people are
currently using +match+ when they actually mean
+get+. This introduces security implications.

This commit disallows calling +match+ without
an HTTP verb constraint by default. To explicitly
match all verbs, this commit also adds a
:via => :all option to +match+.

Closes #5964
2012-04-24 22:52:26 -05:00
Rafael Mendonça França
9efe01ef0d default_url_options does not receive one argument anymore 2012-04-08 23:44:00 -03:00
Piotr Sarnacki
5b94e73d1a Remove ActionController::TestCase#rescue_action_in_public!
This method has no effect since exception handling was
moved to middlewares and ActionController tests do not
use any middlewares.
2012-03-15 04:14:49 +01:00
Santiago Pastorino
d5d241cb2c @controller already includes url_helpers in with_routing method 2012-03-10 19:27:03 -02:00
Sergey Nartimov + José Valim
cd5dabab95 Optimize url helpers. 2012-03-02 15:01:20 +01:00
Ryan McGeary
30e5503d00 Added unit test to cover changes to RouteSet.url_for
ActionDispatch::Routing::RouteSet.url_for now handles passing params through to
ActionDispatch::Http::Url.url_for

Conflicts:

	actionpack/test/controller/base_test.rb
2012-02-07 13:28:30 -05:00
José Valim
e2cc653876 Do not deprecate performed. 2012-01-19 19:52:10 +01:00
Carlos Antonio da Silva
a977b2588e Remove method missing handling when action is not found, use action missing instead
Do not create a method_missing method to handle not found actions, use
the action_missing method provided by Rails instead.
2012-01-17 10:04:38 -02:00
Carlos Antonio da Silva
1ae9e60b8a Remove other old compatibility constants 2012-01-17 10:04:37 -02:00
Aaron Patterson
fd918fe5ed AP tests should inherit from AS::TestCase 2012-01-05 17:05:44 -08:00
Karunakar (Ruby)
131c9ba9d0 Moving to logger methods to ActiveSupport Logger 2011-12-24 00:17:21 +05:30
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
José Valim
ba52748d05 Remove deprecated support to <% form_for %> and several ActionController::Base methods. 2010-08-29 21:08:14 -03:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Santiago Pastorino
824da60ae8 Move Rails module to abstract_unit to make test in isolation work
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 01:26:07 +02:00
Alan Harper
566967eaf3 Missing method error doesn't specify which controller it is missing from [#4436 state:resolved]
The error page shown when the method you are requesting on a controller
doesn't specify which controller the method is missing from

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-10 20:04:37 +02:00
Rizwan Reza
167017f655 Tests method_missing to raise NameError. [#2522 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 00:26:44 -07:00
José Valim
13bb4a6e68 Current url helpers become actions in controller. Added a failing test case for it. 2010-03-22 23:57:06 +01:00
Justin Ko
ea4f8ef33f Reinstate dom_id in controllers.
[#3040 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-09 10:49:36 -08:00
Jeremy Kemper
c507e16dba Reinstate default_url_options and remove url_options= writer 2010-03-08 21:40:45 -08:00
Carlhuda
47fe14bfcc Silence test deprecation warnings 2010-02-26 15:34:12 -08:00
José Valim
bd36418c51 Fix controller_path returnsing an empty string in Ruby 1.8.7 [#4036 status:resolved] 2010-02-26 11:51:21 +01:00
Carlhuda
36fd9efb5e Continued effort to deglobalize the router 2010-02-25 17:53:01 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
José Valim
fc4f237864 Make filter parameters based on request, so they can be modified for anything in the middleware stack. 2010-01-21 16:52:49 +01:00
José Valim
3b631df101 Ensure that segments in default_url_options also work with format specified. 2010-01-07 17:17:06 +01:00
José Valim
f149eb19d4 From now on, parameters defined in default_url_options can be absent from named routes.
This allows the following setup to work:

  # app/controllers/application_controller.rb
  class ApplicationController
    def default_url_options(options=nil)
      { :locale => I18n.locale }
    end
  end

  # From your views and controllers:
  I18n.locale                 #=> :en
  users_url                   #=> "/en/users"
  users_url(:pl)              #=> "/pl/users"
  user_url(1)                 #=> "/en/users/1"
  user_url(:pl, 1)            #=> "/pl/users/1"
  user_url(1, :locale => :pl) #=> "/pl/users/1"

If you provide all expected parameters, it still works as previously.
But if any parameter is missing, it tries to assign all possible ones
with the hash returned in default_url_options or the one passed straight
to the named route method.

Beware that default_url_options in ApplicationController is not shared
with ActionMailer, so you are required to always give the locale in your
email views.
2010-01-07 15:34:14 +01:00
José Valim
f564f947d9 Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
José Valim
75ba102a80 Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened. 2009-12-26 20:28:53 +01:00
Joshua Peek
2be5e088d2 Use new routing dsl in tests 2009-12-08 16:52:26 -06:00
Joshua Peek
a5c82a9dfb Start rewriting some internal tests to use the new routing dsl 2009-10-20 16:03:55 -05:00
Joshua Peek
24ad9ae3d2 Cleanup route reloading in tests. Prefer with_routing over using ActionController::Routing::Routes directly 2009-08-16 21:14:26 -05:00
Yehuda Katz + Carl Lerche
65102c8f1a Cleaning up more tests and code that needed to work in both old and new base 2009-06-17 16:51:51 -07:00
Yehuda Katz + Carl Lerche
47ff57f6d1 Document and clean up HideActions and Http 2009-06-10 15:27:53 -07:00
Yehuda Katz + Carl Lerche
da65320433 Got new base to pass controller/base_test.rb, implemented method_missing action semantics in compatibility mode, and fixed a few action_missing bugs. 2009-05-14 17:25:10 -07:00
Jeremy Kemper
e8550ee032 Cherry-pick core extensions 2009-05-13 12:00:15 -07:00
Joshua Peek
11af089cee Extract ActionController rescue templates into Rescue and ShowExceptions middleware.
This commit breaks all exception catching plugins like ExceptionNotifier. These plugins should be rewritten as middleware instead overriding Controller#rescue_action_in_public.
2009-05-02 23:02:22 -05:00
Yehuda Katz and Carl Lerche
1aadafda8d Updated old AC::Base for small changes to AV 2009-04-08 17:33:41 -07:00
Jeremy Kemper
cf09fa74f7 Include process methods in ActionController::TestCase only. No need to alias_method_chain :process either. 2009-01-09 00:14:27 -08:00
Jeremy Kemper
c82e8e1f48 Move controller assertions from base TestCase to AC:: and AV::TestCase 2008-11-07 15:42:34 -05:00
Jeremy Kemper
a1eb4e11c2 Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, but it has since been removed from 1.9.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

Conflicts:

	actionpack/test/controller/layout_test.rb
2008-08-31 13:20:15 -07:00
Ripta Pasay
f7fdbae770 Use fully-qualified controller name when logging. [#600 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-17 01:33:44 +01:00
Luke Redpath
7650ff892c Fix url_for with no arguments when default_url_options is not explicitly defined. [#339 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-17 20:53:41 +01:00
rick
37599d16f2 regression test for bug introduced in [6a6b4392c16c665eb713705f2b38e959a658eeef] [Ian White] [#22 state:resolved] 2008-05-05 23:42:52 -07:00
Cheah Chu Yeow
ee1d508a6b Allow ActionController::Base#default_url_options to have a default options argument of nil.
This fixes a bug introduced in [6a6b4392c16c665eb713705f2b38e959a658eeef] which was breaking routing in ActionController::UrlWriter.
2008-05-05 23:41:33 -07:00
Cheah Chu Yeow
6a6b4392c1 Ensure that default_url_options, if defined, are used in named routes.
Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#22 state:resolved]
2008-05-04 12:49:44 +12:00
Jeremy Kemper
9d755f1983 require abstract_unit directly since test is in load path
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 13:32:06 +00:00
Jeremy Kemper
1bb208d7e5 Fixup mocha tests for 0.5.6. Closes #10602 [murphy, mikong]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8508 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-29 05:16:03 +00:00
Jeremy Kemper
0ee1cb2cd3 Ruby 1.9 compat, consistent load paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-02 05:32:14 +00:00
Jeremy Kemper
7fce529b2a Mocha 0.4 mixes in more public instance methods, confusing controller identification of action methods. Closes #7347.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6030 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-24 12:04:08 +00:00