Commit Graph

4109 Commits

Author SHA1 Message Date
Xavier Noria
5c53ffe1db Add missing require for Object#try [#3771 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-01-22 22:20:00 +05:30
Joshua Peek
1a750da130 Make @controller an internal ivar in the view 2010-01-22 10:19:01 -06:00
José Valim
02c5137ead Add view paths to Engine setup. 2010-01-22 01:10:31 +01:00
José Valim
7fcf8590e7 Massive cleanup in Railties and load stack. 2010-01-21 23:14:20 +01: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
378464a2e4 Default to sync instrumentation. 2010-01-21 13:09:12 +01:00
José Valim
31fddf2ace Tidy up new filter_parameters implementation. 2010-01-21 11:57:24 +01:00
Prem Sichanugrist
b1bc3b3cd3 Add deprecation warning for calling filter_parameter_logging ActionController::Base, and allow it to be configured in config.filter_parameters
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-21 11:41:31 +01:00
Prem Sichanugrist
bd4f21fbac Move filter_parameter_logging logic out of the controller and create ActionDispatch::ParametersFilter to handle parameter filteration instead. This will make filteration not depending on controller anymore.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-21 10:08:26 +01:00
Sam Ruby
c8cba7db76 Add AD::Route#to_s
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2010-01-20 10:56:27 -06:00
Joshua Peek
93956a18e4 Only send filtered_env for notifications 2010-01-20 10:07:23 -06:00
Joshua Peek
87bcf1aa15 Request#filter_parameters and filter_env 2010-01-20 09:55:58 -06:00
Joshua Peek
909443eab6 Expose last controller in rack env["action_controller.instance"] 2010-01-20 09:00:23 -06:00
José Valim
6e26be6960 Move ActionController::Translation to AbstractController::Translation. 2010-01-20 15:02:13 +01:00
José Valim
8e2fd54b19 Bring normalize behavior to AbstractController::Rendering 2010-01-20 15:02:13 +01:00
Yehuda Katz
1a50d2e66a Stop overriding LoadError.new to return a MissingSourceError (and sometimes nil!) 2010-01-19 22:35:26 -08:00
Joshua Peek
5ebfa62427 Revert streaming params parser support.
AS Xml and Json parsers expect the request body to be a real IO object
supporting methods like getc or ungetc which are not specified by the
Rack spec and aren't supported by Passenger or the Rewindable input
wrapper.

We can restore functionality if the AS parsers are rewritten to support
Racks subset of supported IO methods.
2010-01-19 22:56:38 -06:00
Joshua Peek
a5d06d05fb Cleanup middleware introspection output 2010-01-19 22:56:37 -06:00
Joshua Peek
88ffba2329 Disable ShowExceptions during integration tests 2010-01-19 09:06:21 -06:00
José Valim
a8e25a518a Move parameters to the top on logging. 2010-01-19 15:35:24 +01:00
José Valim
4e2852a487 Do not send rack.input or any other rack information to AD listeners. 2010-01-19 15:35:23 +01:00
Joshua Peek
bec5356f25 Define named routes for other non-GET REST actions 2010-01-19 08:23:23 -06:00
Pratik Naik
ed8501ef16 Fix DoubleRenderError error message 2010-01-19 15:23:56 +05:30
Joshua Peek
71d67fc6bd Prettier hash dump 2010-01-18 21:22:09 -06:00
Joshua Peek
5579de5bab Show Rack env dump on exception page 2010-01-18 21:12:17 -06:00
Joshua Peek
68b76a38eb Cleanup deprecation notices. 2010-01-18 09:49:38 -06:00
Joshua Peek
c29bb8857e Clear out AS callback method pollution in AC::Base.action_methods 2010-01-17 22:06:28 -06:00
Joshua Peek
58fe3295fe Base#action_methods delegates to Base.action_methods 2010-01-17 21:51:07 -06:00
Joshua Peek
eeba755a11 Accessing nonexistant cookies through the signed jar should not raise an
exception
2010-01-17 21:31:06 -06:00
Prem Sichanugrist
eb67532bc1 Make local_request? to returns true when facing ::1 IPv6 address [#3257 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-17 16:56:54 +01:00
José Valim
44a10a2440 Fix resources_path_names branch which was sending an array as entity. [#3715 status:resolved] 2010-01-17 16:18:14 +01:00
José Valim
020e656447 Move middleware builder back to Rails::Rack::Metal without losing the new behavior. 2010-01-17 13:23:38 +01:00
José Valim
27d9836ad3 Add ActionDispatch::Railties::Subscriber and finish tidying up the logging. 2010-01-17 12:43:17 +01:00
José Valim
61ada28ed3 Get rid of prepare_each_request, since now it's a middleware initialization parameter. 2010-01-17 11:44:04 +01:00
José Valim
0334f9f6cf Add ActionDispatch::Notifications middleware. 2010-01-17 11:29:51 +01:00
Joshua Peek
f9a4300415 debug helper output should not be sanitized 2010-01-16 21:43:03 -06:00
Joshua Peek
eb39d0f7b9 Use backtrace cleaner for dev mode exception page 2010-01-16 21:34:35 -06:00
Joshua Peek
d2d4acf027 Cookies middleware 2010-01-16 17:22:27 -06:00
Joshua Peek
603d4fbacd Build middleware stack and reload routes after app initializers run
[#3709 state:resolved]
2010-01-16 16:15:32 -06:00
Pratik Naik
dba196cb7f Merge docrails 2010-01-17 03:26:20 +05:30
Joshua Peek
e9a1dbe79a Allow custom controller for resource(s) [#3703 state:resolved] 2010-01-16 15:16:22 -06:00
José Valim
92f49b5f1e Split ActionDispatch http in smaller chunks. 2010-01-16 15:45:07 +01:00
Joshua Peek
b2578a148c Fix singleton resource named routes 2010-01-15 16:31:00 -06:00
Joshua Peek
89082004b0 Fix const reference for SessionRestoreError 2010-01-15 16:20:12 -06:00
Joshua Peek
6437eb9f35 Always join scoped paths with slashes 2010-01-15 16:13:01 -06:00
Joshua Peek
576b8dda52 Cleanup internal resource macro to use method helper shorthand 2010-01-15 16:13:01 -06:00
Joshua Peek
184ef28f55 Routing method shorthand shouldn't clobber :to options 2010-01-15 14:55:13 -06:00
Joshua Peek
ead93c5be5 Move Flash into middleware 2010-01-15 14:55:13 -06:00
Joshua Peek
3eaf525213 Make HEAD method masquerade as GET so requests are routed correctly 2010-01-15 12:38:50 -06:00
José Valim
1c30ec23fe In heterogeneous collections, neither the @path nor the @template are available, so we need to tell that we are simply rendering a collection. 2010-01-15 17:43:45 +01:00
José Valim
a0cdfdc771 Allow f.submit to be localized per object. 2010-01-15 16:10:19 +01:00
José Valim
e5a2a9fced Remove URI object from ActiveResource notification, send the :mailer class in AM (like in AP#process_action) and remove locale instrumentation. 2010-01-15 15:57:33 +01:00
José Valim
4598d88749 Ensure log is flushed and tailed on failures. 2010-01-15 14:16:52 +01:00
José Valim
a5a9156b4e Template rendering should include layout time. 2010-01-15 12:24:32 +01:00
José Valim
88dd60298e Do not send the whole controller in notifications, cherry pick required pieces. 2010-01-15 12:24:31 +01:00
José Valim
8b9bff9557 Small tweaks in ActionController subscriber messages format. 2010-01-15 12:24:31 +01:00
José Valim
8c8942ed4f Move Dispatcher setup to Railties and add instrumentation hook. 2010-01-15 12:24:30 +01:00
Joshua Peek
be968ecd8b Respect resources_path_names and :path_names options in new dsl 2010-01-13 20:26:01 -06:00
Joshua Peek
0f51e45307 optimise_named_routes is unnecessary 2010-01-13 20:22:53 -06:00
José Valim
9038a4af35 Add documentation to f.submit and make scaffold generators use the new shortcut. 2010-01-14 02:02:07 +01:00
José Valim
35933822de Ensure optional path scopes are properly handled. 2010-01-14 01:31:17 +01:00
Stephen Celis
2835ec6134 Custom 'type' attribute support for text_field. [#3646 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-14 01:07:04 +01:00
José Valim
214b548485 Make check boxes accept :multiple as option so they can handle collections (such as HABTM). 2010-01-14 01:07:03 +01:00
José Valim
d50bf47b00 Call :to_model before working with the object. 2010-01-14 01:07:03 +01:00
Carlos Antonio da Silva
8e0208f650 Add possibility to use i18n translatios in submit FormHelper.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-14 01:07:03 +01:00
José Valim
f921ad5c97 Tidy up ActiveRecord and Views runtime information on process action logger. 2010-01-14 01:07:03 +01:00
Joshua Peek
d01716731b Add router support for resources :only and :except actions 2010-01-13 17:23:14 -06:00
Joshua Peek
bf9b81e2cb Pass :as to resources to change the resource name 2010-01-13 12:18:06 -06:00
Joshua Peek
521ef3c40f Passing in a crud action overloads the default action instead of creating a
new member action.
2010-01-13 11:45:27 -06:00
José Valim
b0d35ad00c Test fragment/page cache and send data/file notifications. 2010-01-13 01:19:24 +01:00
José Valim
da5978c223 Add subscriber for ActionPack and move all logging inside it. 2010-01-13 01:19:23 +01:00
José Valim
d382e93d8f Improve ActionPack logger output. 2010-01-11 23:38:17 +01:00
José Valim
a9eebde856 Merge branch 'master' of git://github.com/rails/rails 2010-01-11 15:18:24 +01:00
José Valim
0a8004efd2 Provide useful information when instrumenting partials. 2010-01-11 10:21:15 +01:00
Joshua Peek
02bbde4e78 Cleanup junk metal and revise API
API Change: Returning a "X-Cascade: pass" header triggers the cascade
instead of a 404 response.
2010-01-10 23:09:10 -06:00
David Heinemeier Hansson
5ddc597066 Use safe_concat instead of trying to html_safe! what might be a frozen string 2010-01-10 18:13:43 -08:00
José Valim
d2e7c1b97d Raise an error if respond_with is invoked and no format is declared. 2010-01-10 20:21:08 +01:00
José Valim
8d72ba51ba Ensure nested namespaces work as expected. 2010-01-10 18:42:45 +01:00
Joao Carlos
36969c6ecd Fixes namespaced routes [#3673 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-10 12:49:31 +01:00
David Heinemeier Hansson
d4589e96ef Fixed that PrototypeHelper#update_page should return html_safe [DHH] 2010-01-08 13:46:30 -08:00
David Heinemeier Hansson
188d52165b Fixed that much of DateHelper wouldn't return html_safe? strings [DHH] 2010-01-08 11:49:12 -08:00
David Heinemeier Hansson
5ea130943e Fixed that fragment caching should return a cache hit as html_safe (or it would all just get escaped) [DHH] 2010-01-07 17:45:32 -08: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
598456b68b Updated the documentation for helpers.label. 2010-01-07 15:31:50 +01:00
José Valim
c68cc49dcd Use helpers.label instead of views.labels. 2010-01-07 15:31:50 +01:00
José Valim
a091e2e4f6 errors in ActionView should not be namespaced as well. 2010-01-07 15:31:50 +01:00
José Valim
0d5ce7c525 namespace in routes changes both the path and name prefix. 2010-01-06 09:51:46 +01:00
José Valim
e4099c2ad3 Allow named routes to be debugged. 2010-01-06 09:32:29 +01:00
José Valim
10389a4c29 Ruby 1.9.1 requires hash given to foormat to contain symbols. 2010-01-06 00:42:58 +01:00
José Valim
0cf190001e Remove CGI.escape in function of Rack::Mount.escape 2010-01-06 00:33:17 +01:00
José Valim
e55d70a380 redirect in routes takes port into account [#3653 status:resolved] 2010-01-05 23:40:56 +01:00
Joshua Peek
b3900a29eb All router redirect helper to accept a full URI [#3653 state:resolved] 2010-01-05 12:00:38 -06:00
Joshua Peek
8ff4faf66a assert_template depends on AV::Template monkey patches in action_view/test_case 2010-01-05 11:48:06 -06:00
David Heinemeier Hansson
2dc5aeed6d NumberHelper#number_to_currency should output html_safe strings so the units are not escaped 2010-01-05 08:22:17 -08:00
Jeremy Kemper
5c527c2f61 Controller tests should always require view tests since they add behavior controllers expect 2010-01-04 19:44:27 -08:00
Joshua Peek
3f28e0bda6 Trash string coercion rack hacks 2010-01-04 19:46:21 -06:00
Joshua Peek
76b5f18feb Default middleware stack needs to be available at configuration time 2010-01-04 19:40:16 -06:00
Joshua Peek
2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
Joshua Peek
cf83a6f16b Autoload AC and AV test case classes 2010-01-04 16:22:46 -06:00
José Valim
562a00ba16 @_formats initialization should be AbstractController::Base. 2010-01-04 23:05:28 +01:00
José Valim
bd729344a7 Remove deprecated formatted named routes 2010-01-04 23:05:27 +01:00
Zach Brock
79438b4638 adding fix for auto linking to master too
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-01-05 10:57:20 +13:00
David Heinemeier Hansson
5e94d3e3ea Merge 2010-01-03 22:27:28 -08:00
David Heinemeier Hansson
090d12b49b Added that ActionController::Base now does helper :all instead of relying on the default ApplicationController in Rails to do it [DHH] 2010-01-03 21:32:02 -05:00
José Valim
3990310a2b Use underscore in notification namespaces. 2010-01-04 00:03:56 +01:00
José Valim
53c6984944 Add notifications to ActionDispatch::ShowExceptions, this can be used as hooks for plugins like ExceptionNotifier. 2010-01-03 23:33:34 +01:00
José Valim
6fbe9ef2ff Use namespaces in notifications. 2010-01-03 20:39:42 +01:00
Stefan Penner
d531cbc809 fixed missing or incorrect session data error message 2010-01-02 23:01:06 -08:00
Mikel Lindsaar
42aa9b87c2 Silence warnings 2010-01-02 22:39:00 -08:00
José Valim
f50bb48e04 Do not enforce human_attribute_name as required API. 2010-01-02 22:27:03 +01:00
Carsten Gehling
bef968d379 I18n label helper [#745 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-02 22:27:02 +01:00
José Valim
50aa876f32 Make rendering in ActionView happen through _render_template, as the rendering which comes from ActionController. 2009-12-31 18:40:20 -08:00
José Valim
c03c40b481 Expose a _render_partial hook as thhe _render_template one and make use of it. 2009-12-31 18:40:20 -08:00
José Valim
33c98b15bc ActionController::Logger should include AbstractController::Logger and sort autoloads for easier readability. 2009-12-31 18:40:20 -08:00
José Valim
38fa0d14a8 controller_path is required by ActionView, so move it up to AbstractController and refactor AbstractController::Layouts. 2009-12-31 18:40:20 -08:00
Carl Lerche
ae7ada1fde Some railties cleanup:
* Rename <framework>/rails.rb -> <framework>/railtie.rb
	* Rails::Plugin -> Rails::Railtie
	* Rails::Plugin::Vendored -> Rails::Plugin
2009-12-31 13:12:52 -08:00
Carl Lerche
e749424dfa Rename rails.rb -> rails/all.rb and rails/core.rb -> rails.rb 2009-12-31 13:12:52 -08:00
Carl Lerche
a23f4b6aee Add a /rails.rb for each framework for consistency 2009-12-31 11:57:59 -08:00
Jeremy Kemper
1fbd02e446 Revert "Add config.action_controller.include behavior to plugins."
This reverts commit 7e8b7f46bfc086a36db996420fbee93348c5268e.

Conflicts:

	railties/lib/rails/plugin.rb
2009-12-30 19:34:15 -08:00
Jeremy Kemper
8ad9d14494 Partially revert "ActionDispatch should require as little of ActiveSupport as possible"
Removes load path change from commit bb153f42e45160c5ef3593c393db5d3c6857fb70.
2009-12-30 17:35:17 -08:00
Carl Lerche
bb153f42e4 ActionDispatch should require as little of ActiveSupport as possible 2009-12-30 12:58:40 -08:00
Carl Lerche
2e87196d14 Use extlib_inheritable_accessor in request_forgery_protection.rb.
For some reason the current class_inheritable_accessor does not play nice with included hooks. class_inheritable_accessor will be revised shortly.
2009-12-29 13:21:36 -08:00
Yehuda Katz
cf4978313b Make sure evalled method knows where it came from 2009-12-29 01:04:32 -08:00
Jeremy Kemper
f79caa49fb Complain if there's no such middleware 2009-12-28 20:24:28 -08:00
Carl Lerche
d747b6847b Require active_support/dependencies/autoload in action_dispatch 2009-12-28 17:53:05 -08:00
Jeremy Kemper
9a650a6547 Silence some trivial warnings: shadowed local vars, indentation mismatches 2009-12-28 17:36:08 -08:00
Jeremy Kemper
7c4fb93ac3 Ruby 1.9: string is not enumerable, so #exclude? is not available 2009-12-27 15:38:00 -08:00
Jeremy Kemper
3a79117c77 Typo 2009-12-27 15:27:18 -08:00
David Heinemeier Hansson
438a8c3ec7 Require the enumberable extension from active support because we use #exclude? 2009-12-27 15:23:30 -08:00
Yehuda Katz
12e43494a7 Merge remote branch 'jose/perf' 2009-12-27 14:36:59 -08:00
David Heinemeier Hansson
95762cbbb3 Added shorthand for match 'products/overview' that expands to match 'products/overview', :to => 'products#overview', :as => 'products_overview' 2009-12-27 14:13:03 -08:00
José Valim
97db79ab3c Remove ActiveRecord runtime logging from ActionPack and place in ActiveRecord, adding it through config.action_controller.include hook. 2009-12-27 13:32:40 +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
feb7382047 AD::Cascade that supports X-Cascade 2009-12-26 13:28:06 -06:00
Joshua Peek
673fa7f066 rack-mount 0.4 2009-12-26 13:25:36 -06:00
José Valim
8a36e907d2 More <%= render(@posts) %> optimization. 2009-12-26 14:11:04 +01:00
José Valim
ff1a1c0b4d Optimize <%= render(@posts) %>. 2009-12-26 14:11:04 +01:00
José Valim
c86424a72d Break instrumentation into several end-points so rendering of partials can be optimized. 2009-12-26 14:11:04 +01:00
José Valim
48273a44c6 Wrap layout rendering in one method: _render_layout (this should make partial instrumentation easier). 2009-12-26 14:11:04 +01:00
David Heinemeier Hansson
7f5d44bac5 The controller key shouldnt be part of the mapping if its not used 2009-12-25 10:14:44 -08:00
Yehuda Katz
f3b072189a Instead of marking raw text in templates as safe, and then putting them through String#<< which checks if the String is safe, use safe_concat, which uses the original (internal) String#<< and leaves the safe flag as is. Results in a significant performance improvement. 2009-12-24 21:50:18 -08:00
Yehuda Katz
baaaf2acaa Dead code 2009-12-24 21:50:17 -08:00
David Heinemeier Hansson
0a365d63f6 Translated strings in the view are assumed html_safe (Closes #3401) 2009-12-24 20:32:53 -08:00
David Heinemeier Hansson
6ce5982afa Stray carrier return 2009-12-24 16:13:50 -08:00
David Heinemeier Hansson
38af368360 Merge 2009-12-24 15:24:57 -08:00
David Heinemeier Hansson
2b7256a42e Extract Mapping class from monster match method 2009-12-24 15:23:39 -08:00
Sam Ruby
aa3565f3a6 Allow named_routes to be used with root, and with new DSL short-form.
The real use case it to make all of the following act the same:

  root 'store#index', :as => 'store'
  match '/' => 'store#index', :as => 'store'
  match '/', :to => 'store#index', :as => 'store'

The test case provided deviates from this in order to demonstrate all three
forms in a single set of test routes.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 20:55:21 -08:00
Carlhuda
84f1137ef8 Merge remote branch 'origin/master'
Conflicts:
	railties/lib/rails/application.rb
2009-12-23 19:18:11 -08:00