Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4708

Show
Ignore:
Timestamp:
08/07/06 09:25:21 (2 years ago)
Author:
bitsweat
Message:

r3022@ks: jeremy | 2005-11-12 18:40:42 -0800
merge to stable
r3024@ks: jeremy | 2005-11-12 19:00:49 -0800
Apply [2992] to stable. SQLite: the clone_structure_to_test and purge_test_database Rake tasks should always use the test environment. References #2846.
r3027@ks: jeremy | 2005-11-12 22:37:45 -0800
Apply [2994] to stable. PostgreSQL: correct the sequence discovery fallback query. References #2594.
r3033@ks: jeremy | 2005-11-12 23:27:13 -0800
Apply [2996] to stable. Much faster Oracle column reflection. Closes #2848.
r3037@ks: jeremy | 2005-11-13 00:11:26 -0800
Apply [2998] to stable. PostgreSQL: last_insert_id uses select_value rather than using @connection.exec directly.
r3053@ks: jeremy | 2005-11-13 14:37:39 -0800
Only include builtin filters whose filenames match /[a-z][a-z_]*_helper.rb$/ to avoid including operating system metadata such as ._foo_helper.rb. Closes #2855.
r3055@ks: jeremy | 2005-11-13 14:48:48 -0800
Apply [3009] to stable: Reapply [2942] which was elided by [2997]. References #2788.
r3058@ks: jeremy | 2005-11-13 16:09:17 -0800
Apply [3013] to stable. Note that the ruby-memcache bindings are required to use the memcache store. Closes #2857.
r3063@ks: jeremy | 2005-11-13 16:13:51 -0800
Apply [3015] to stable. Update documentation for render :file. Closes #2858.
r3066@ks: jeremy | 2005-11-13 20:24:18 -0800
Apply [3017] to stable. Update documentation for Migrations. Closes #2861.
r3070@ks: jeremy | 2005-11-13 20:54:50 -0800
Apply [3019] to stable. Oracle: test case for column default parsing. Closes #2788.
r3073@ks: jeremy | 2005-11-13 23:42:32 -0800
Apply [3021] to stable. Correct documentation for Base.delete_all. Closes #1568.
r3077@ks: jeremy | 2005-11-14 14:28:21 -0800
Apply [3035] to stable. SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. Closes #2866.
r3120@ks: jeremy | 2005-11-16 13:34:45 -0800
Apply [3060] to stable. Remove the unused, slow response_dump and session_dump variables from error pages. Closes #1222.
r3130@ks: jeremy | 2005-11-16 14:37:47 -0800
Apply [3063] to stable. Remove CHANGELOG from apidoc Rake task since it isn't included with new apps anymore.
r3148@ks: jeremy | 2005-11-17 12:45:44 -0800
Apply [3074] to stable. Don't add the same conditions twice in has_one finder sql. Closes #2916.
r3149@ks: jeremy | 2005-11-17 12:47:36 -0800
Apply [3075] to stable. Document :force option to create_table. Closes #2921.
r3157@ks: jeremy | 2005-11-17 21:27:39 -0800
Apply [3081] to stable. Eliminate nil from newly generated logfiles. Closes #2927.
r3167@ks: jeremy | 2005-11-18 22:47:31 -0800
Apply [3089] to stable. Don't generate read methods for columns whose names are not valid ruby method names. Closes #2946.
r3174@ks: jeremy | 2005-11-19 01:53:00 -0800
Apply [3092] to stable. Correct boolean handling in generated reader methods. Closes #2945.
r3178@ks: jeremy | 2005-11-19 01:59:47 -0800
Apply [3094] to stable. Use query methods rather than readers in boolean tests for [3092]. References #2949.
r3190@ks: jeremy | 2005-11-19 20:20:48 -0800
Apply [3098] to stable. Introducing the session_migration generator. Creates an add_session_table migration. Closes #2958.
r3199@ks: jeremy | 2005-11-19 21:13:22 -0800
Apply [3101] to stable. Allows generator to specify migrations directory. Closes #2960.
r3201@ks: jeremy | 2005-11-19 21:31:47 -0800
Apply [3103] to stable. Document request.env and request.host. Strip trailing whitespace.
r3258@ks: jeremy | 2005-11-21 00:33:59 -0800
Apply [3139] to stable. Use Kernel.binding rather than binding to allow columns of that name. Closes #2973.
r3269@ks: jeremy | 2005-11-21 04:46:40 -0800
Apply [3148] to stable. Simpler Mysql load test.
r3285@ks: jeremy | 2005-11-22 13:33:04 -0800
Apply [3162] to stable. Model generator: correct relative path to test_helper in unit test.
r3296@ks: jeremy | 2005-11-23 13:38:56 -0800
Apply [3170] to stable. Credit ticket author. References #2888.
r3303@ks: jeremy | 2005-11-23 17:14:31 -0800
Apply [3051], [3052], [3053], [3059] to stable. Brings the Firebird adapter to 1.0. References #1874.
r3305@ks: jeremy | 2005-11-23 17:33:51 -0800
Apply [3151] to stable. Don't put flash in session if sessions are disabled.
r3306@ks: jeremy | 2005-11-23 17:39:24 -0800
Apply [3100], [3108] to stable. Makes new ActiveRecordStore sessions work correctly with components.
r3307@ks: jeremy | 2005-11-23 17:52:14 -0800
Apply [3110] to stable. PostgreSQL: the purge_test_database Rake task shouldn't explicitly specify the template0 template when creating a fresh test database. References #2964.
r3313@ks: jeremy | 2005-11-23 23:03:36 -0800
Apply [3182] to stable. Reloading a model doesn't lose track of its connection. Closes #2996.
r3315@ks: jeremy | 2005-11-23 23:13:48 -0800
Apply [3184] to stable. SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. Closes #2974.
r3339@ks: jeremy | 2005-12-01 17:03:16 -0800
Apply [3202] to stable. Firebird: updated for FireRuby 0.4.0. Closes #3009.
r3363@ks: jeremy | 2005-12-06 22:26:27 -0800
Apply #428 changesets to stable: r3000, r3001, r3002, r3025, r3045, r3096, r3148, r3152, r3165, r3189, r3195, r3205, r3216, r3219, r3221, r3222. Closes #428.
r3372@ks: jeremy | 2005-12-07 20:25:20 -0800
Apply [3233] to stable. Oracle: use syntax compatible with Oracle 8. Closes #3131.
r3375@ks: jeremy | 2005-12-07 20:36:13 -0800
Apply [3235] to stable. PostgreSQL: more robust sequence name discovery. Closes #3087.
r3378@ks: jeremy | 2005-12-07 20:41:47 -0800
Apply [3237] to stable. More robust relative url root discovery for SCGI compatibility. This solves the 'SCGI routes problem' -- you no longer need to prefix all your routes with the name of the SCGI mountpoint. Closes #3070.
r3379@ks: jeremy | 2005-12-07 20:42:31 -0800
Don't warn on keep_flash in test.
r3387@ks: jeremy | 2005-12-07 20:48:42 -0800
Apply [3242] to stable. Reloading an instance refreshes its aggregations as well as its associations. Closes #3024.
r3389@ks: jeremy | 2005-12-07 20:52:39 -0800
Apply [3244] to stable. SQLite: find database file when RAILS_ROOT is a symlink. Closes #3116.
r3392@ks: jeremy | 2005-12-07 21:10:42 -0800
Apply [3246] to stable. MySQL: more robust test for nullified result hashes. Closes #3124.
r3401@ks: jeremy | 2005-12-07 23:30:11 -0800
Apply [3252] to stable. Oracle: active? performs a select instead of a commit. Closes #3133.
r3404@ks: jeremy | 2005-12-08 15:24:44 -0800
Apply [3254] to stable. Fix some test failures due to MySQL assumptions. References #3149.
r3407@ks: jeremy | 2005-12-09 10:39:00 -0800
Apply [3256] to stable. Generator copies files in binary mode. Closes #3156.
r3410@ks: jeremy | 2005-12-09 10:48:32 -0800
Apply [3258] to stable. Fix shebang handling for empty files. Closes #2927.
r3413@ks: jeremy | 2005-12-09 15:03:42 -0800
Apply [3260] to stable. Fix bundled mysql.rb to correctly check for PROTO_41. Fixed scramble41 with nil password. Fixed change_user with PROTO_41.
r3416@ks: jeremy | 2005-12-09 15:07:21 -0800
Apply [3262] to stable. Generator looks in vendor/generators also.
r3419@ks: jeremy | 2005-12-09 15:36:50 -0800
Apply [3165] to stable. MySQL, PostgreSQL: reconnect! also reconfigures the connection. Otherwise, the connection 'loses' its settings if it times out and is reconnected. References #2978.
r3420@ks: jeremy | 2005-12-09 15:38:30 -0800
Apply [3264] to stable. MySQL: ensure that @config is set.
r3421@ks: jeremy | 2005-12-09 15:42:40 -0800
Apply [3265] to stable. Name vendor/generators source differently from lib/generators source.
r3429@ks: jeremy | 2005-12-09 16:55:16 -0800
Apply [3270] SQLServer rollup to stable.
r3435@ks: jeremy | 2005-12-10 13:40:43 -0800
Apply [3274] to stable. MySQL: fixes for the bundled mysql.rb driver. Closes #3160.
r3457@ks: jeremy | 2005-12-13 08:52:39 -0800
Apply [3293] to stable. MySQL: allow encoding option for mysql.rb driver.
r3458@ks: jeremy | 2005-12-13 09:33:50 -0800
Roll back [3245] on stable. References #3116.
r3465@ks: jeremy | 2005-12-13 10:15:33 -0800
Apply [3298] to stable. Don't used defined? on a scoped constant since it results in a const_missing call.
r3724@ks: jeremy | 2006-02-09 10:13:41 -0800
Apply [3554] to stable. PostgreSQL: correctly parse negative integer column defaults. Closes #3776.
r3730@ks: jeremy | 2006-02-09 11:42:57 -0800
Apply [3559] to stable. Closes #3581.
r3846@ks: jeremy | 2006-02-26 15:24:58 -0800
silence test/unit whining DefaultsTest is empty
r3847@ks: jeremy | 2006-02-26 15:26:53 -0800
Apply [3674] to stable. Closes #3591.
r4960@ks: jeremy | 2006-08-06 23:56:18 -0700
Merged to stable: change the request.env example in AC::Base docs to a var that exists (REMOTE_IP doesn't) and isn't already wrapped by a request method (i.e. request.remote_ip). References #5113.
r4961@ks: jeremy | 2006-08-07 00:11:59 -0700
Merged to stable: add :status option to send_data and send_file. Defaults to '200 OK'. References #5243.
r4962@ks: jeremy | 2006-08-07 00:18:42 -0700
Merged to stable: real files and symlinks should be treated the same when compiling templates. References #5438.
r4963@ks: jeremy | 2006-08-07 00:26:42 -0700
Merged to stable: Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled. References #1897.
r4964@ks: jeremy | 2006-08-07 00:33:32 -0700
Merged to stable: correct spurious documentation example code which results in a SyntaxError. References [4210].
r4965@ks: jeremy | 2006-08-07 00:38:04 -0700
Merged to stable: remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for. References [4215].
r4966@ks: jeremy | 2006-08-07 00:48:40 -0700
Merged to stable: update inconsistent migrations documentation. References #4683.
r4967@ks: jeremy | 2006-08-07 00:52:34 -0700
Merge to stable: cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. References [4256].
r4968@ks: jeremy | 2006-08-07 00:55:51 -0700
Merge to stable: only require redcloth/bluecloth if they are not already loaded. References [4257].
r4977@ks: jeremy | 2006-08-07 01:08:02 -0700
Merge to stable: skip silence stderr test if we can't STDERR.tell
r4978@ks: jeremy | 2006-08-07 01:13:00 -0700
Merge to stable: update layout and content_for documentation to use yield rather than magic @content_for_layout instance variables. References [4263].
r4979@ks: jeremy | 2006-08-07 01:16:43 -0700
Merge to stable: add documentation for redirect_to :back's RedirectBackError exception; remove all remaining references to @params in the documentation. References [4267], [4268].
r4980@ks: jeremy | 2006-08-07 01:18:04 -0700
Merge to stable: fix documentation indentation.
r4981@ks: jeremy | 2006-08-07 01:28:34 -0700
Merge to stable: mention in docs that config.frameworks doesn't work when getting Rails via Gems; documentation for AbstractRequest. References #4857, #4895.
r4982@ks: jeremy | 2006-08-07 01:45:26 -0700
Merge to stable: fix syntax error in documentation. References #4679.
r4983@ks: jeremy | 2006-08-07 01:50:47 -0700
Merge to stable: Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. References #4079. Add warning about the proper way to validate the presence of a foreign key. References #4147.
r4984@ks: jeremy | 2006-08-07 02:08:00 -0700
Merge to stable: ActionController::Base Summary documentation rewrite; Fix text_helper.rb documentation rendering; Fixes bad rendering of JavaScriptMacrosHelper rdoc. References #4725, #4900, #4910.
r4985@ks: jeremy | 2006-08-07 02:14:18 -0700
Merge to stable: documentation fix: integration test scripts don't require integration_test. References #4914.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/stable/actionmailer/CHANGELOG

    r4694 r4708  
     1*SVN* 
     2 
     3* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.] 
     4 
    15* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com] 
     6 
    27 
    38*1.2.3* (June 29th, 2006) 
  • branches/stable/actionmailer/lib/action_mailer/base.rb

    r4694 r4708  
    1515  #       recipients recipient.email_address_with_name 
    1616  #       subject    "New account information" 
    17   #       body       { "account" => recipient } 
     17  #       body       "account" => recipient 
    1818  #       from       "system@example.com" 
    1919  #     end 
  • branches/stable/actionpack/CHANGELOG

    r4701 r4708  
     1*SVN* 
     2 
     3* Documentation fix: integration test scripts don't require integration_test.  #4914 [Frederick Ros <sl33p3r@free.fr>] 
     4 
     5* ActionController::Base Summary documentation rewrite.  #4900 [kevin.clark@gmail.com] 
     6 
     7* Fix text_helper.rb documentation rendering.  #4725 [Frederick Ros] 
     8 
     9* Fixes bad rendering of JavaScriptMacrosHelper rdoc.  #4910 [Frederick Ros] 
     10 
     11* Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there.  #4079 [Rick Olson] 
     12 
     13* Documentation for AbstractRequest.  #4895 [kevin.clark@gmail.com]  
     14 
     15* Remove all remaining references to @params in the documentation. [Marcel Molina Jr.] 
     16 
     17* Add documentation for redirect_to :back's RedirectBackError exception.  [Marcel Molina Jr.] 
     18 
     19* Update layout and content_for documentation to use yield rather than magic @content_for instance variables. [Marcel Molina Jr.] 
     20 
     21* Cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. [Rick] 
     22 
     23* Fixed that remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for [DHH] 
     24 
     25* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled.  #1897 [jeremye@bsa.ca.gov] 
     26 
     27* Fixed that real files and symlinks should be treated the same when compiling templates.  #5438 [zachary@panandscan.com] 
     28 
     29* Add :status option to send_data and send_file. Defaults to '200 OK'.  #5243 [Manfred Stienstra <m.stienstra@fngtps.com>] 
     30 
     31* Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net] 
     32 
     33* Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com] 
     34 
     35 
    136*1.12.3* (June 28th, 2006) 
    2 ======= 
    3  
    4 * Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net] 
    5  
    6 * Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com] 
    7  
    8 * Pass :id => nil or :class => nil to error_messages_for to supress that html attribute. #3586 [olivier_ansaldi@yahoo.com, sebastien@goetzilla.info] 
    937 
    1038* Fix broken traverse_to_controller. We now: 
  • branches/stable/actionpack/lib/action_controller/base.rb

    r4157 r4708  
    5050  end 
    5151 
    52   # Action Controllers are made up of one or more actions that performs its purpose and then either renders a template or 
    53   # redirects to another action. An action is defined as a public method on the controller, which will automatically be  
    54   # made accessible to the web-server through a mod_rewrite mapping. A sample controller could look like this: 
     52  # Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed  
     53  # on request and then either render a template or redirect to another action. An action is defined as a public method 
     54  # on the controller, which will automatically be made accessible to the web-server through Rails Routes.  
     55  # 
     56  # A sample controller could look like this: 
    5557  # 
    5658  #   class GuestBookController < ActionController::Base 
    5759  #     def index 
    58   #       @entries = Entry.find_all 
     60  #       @entries = Entry.find(:all) 
    5961  #     end 
    6062  #      
     
    6567  #   end 
    6668  # 
    67   #   GuestBookController.template_root = "templates/" 
    68   #   GuestBookController.process_cgi 
    69   # 
    70   # All actions assume that you want to render a template matching the name of the action at the end of the performance 
    71   # unless you tell it otherwise. The index action complies with this assumption, so after populating the @entries instance 
    72   # variable, the GuestBookController will render "templates/guestbook/index.rhtml". 
    73   # 
    74   # Unlike index, the sign action isn't interested in rendering a template. So after performing its main purpose (creating a  
    75   # new entry in the guest book), it sheds the rendering assumption and initiates a redirect instead. This redirect works by 
    76   # returning an external "302 Moved" HTTP response that takes the user to the index action. 
     69  # Actions, by default, render a template in the <tt>app/views</tt> directory corresponding to the name of the controller and action 
     70  # after executing code in the action. For example, the +index+ action of the +GuestBookController+  would render the  
     71  # template <tt>app/views/guestbook/index.rhtml</tt> by default after populating the <tt>@entries</tt> instance variable. 
     72  # 
     73  # Unlike index, the sign action will not render a template. After performing its main purpose (creating a  
     74  # new entry in the guest book), it initiates a redirect instead. This redirect works by returning an external  
     75  # "302 Moved" HTTP response that takes the user to the index action. 
    7776  # 
    7877  # The index and sign represent the two basic action archetypes used in Action Controllers. Get-and-show and do-and-redirect. 
    7978  # Most actions are variations of these themes. 
    80   # 
    81   # Also note that it's the final call to <tt>process_cgi</tt> that actually initiates the action performance. It will extract 
    82   # request and response objects from the CGI 
    83   # 
    84   # When Action Pack is used inside of Rails, the template_root is automatically configured and you don't need to call process_cgi 
    85   # yourself. 
    8679  # 
    8780  # == Requests 
     
    9588  # are made by accessing the environment hash, like this: 
    9689  # 
    97   #   def hello_ip 
    98   #     location = request.env["REMOTE_IP"] 
    99   #     render :text => "Hello stranger from #{location}" 
     90  #   def server_ip 
     91  #     location = request.env["SERVER_ADDR"] 
     92  #     render :text => "This server hosted at #{location}" 
    10093  #   end 
    10194  # 
    10295  # == Parameters 
    10396  # 
    104   # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash. 
    105   # So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 } 
    106   # in params. 
     97  # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method 
     98  # which returns a hash. For example, an action that was performed through <tt>/weblog/list?category=All&limit=5</tt> will include  
     99  # <tt>{ "category" => "All", "limit" => 5 }</tt> in params. 
    107100  # 
    108101  # It's also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as: 
     
    117110  # == Sessions 
    118111  # 
    119   # Sessions allows you to store objects in memory between requests. This is useful for objects that are not yet ready to be persisted, 
     112  # Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted, 
    120113  # such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such 
    121114  # as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely  
    122115  # they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at. 
    123116  # 
    124   # You can place objects in the session by using the <tt>session</tt> hash accessor
     117  # You can place objects in the session by using the <tt>session</tt> method, which accesses a hash
    125118  # 
    126119  #   session[:person] = Person.authenticate(user_name, password) 
     
    129122  # 
    130123  #   Hello #{session[:person]} 
    131   # 
    132   # Any object can be placed in the session (as long as it can be Marshalled). But remember that 1000 active sessions each storing a 
    133   # 50kb object could lead to a 50MB memory overhead. In other words, think carefully about size and caching before resorting to the use 
    134   # of the session. 
    135124  # 
    136125  # For removing objects from the session, you can either assign a single key to nil, like <tt>session[:person] = nil</tt>, or you can 
    137126  # remove the entire session with reset_session. 
    138127  # 
     128  # By default, sessions are stored on the file system in <tt>RAILS_ROOT/tmp/sessions</tt>. Any object can be placed in the session  
     129  # (as long as it can be Marshalled). But remember that 1000 active sessions each storing a 50kb object could lead to a 50MB store on the filesystem. 
     130  # In other words, think carefully about size and caching before resorting to the use of the session on the filesystem. 
     131  # 
     132  # An alternative to storing sessions on disk is to use ActiveRecordStore to store sessions in your database, which can solve problems 
     133  # caused by storing sessions in the file system and may speed up your application. To use ActiveRecordStore, uncomment the line: 
     134  #    
     135  #   config.action_controller.session_store = :active_record_store 
     136  # 
     137  # in your <tt>environment.rb</tt> and run <tt>rake db:sessions:create</tt>. 
     138  # 
    139139  # == Responses 
    140140  # 
    141141  # Each action results in a response, which holds the headers and document to be sent to the user's browser. The actual response 
    142   # object is generated automatically through the use of renders and redirects, so it's normally nothing you'll need to be concerned about
     142  # object is generated automatically through the use of renders and redirects and requires no user intervention
    143143  # 
    144144  # == Renders 
     
    162162  #     @results = Search.find(params[:query]) 
    163163  #     case @results 
    164   #       when 0 then render :action=> "no_results" 
    165   #       when 1 then render :action=> "show" 
    166   #       when 2..10 then render :action=> "show_many" 
     164  #       when 0 then render :action => "no_results" 
     165  #       when 1 then render :action => "show" 
     166  #       when 2..10 then render :action => "show_many" 
    167167  #     end 
    168168  #   end 
     
    172172  # == Redirects 
    173173  # 
    174   # Redirecting is what actions that update the model do when they're done. The <tt>save_post</tt> method shouldn't be responsible for also 
    175   # showing the post once it's saved -- that's the job for <tt>show_post</tt>. So once <tt>save_post</tt> has completed its business, it'll 
    176   # redirect to <tt>show_post</tt>. All redirects are external, which means that when the user refreshes his browser, it's not going to save 
    177   # the post again, but rather just show it one more time. 
    178   #  
    179   # This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting 
    180   # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as 
    181   # "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider 
    182   # "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703. 
    183   #  
    184   # Redirects work by rewriting the URL of the current action. So if the show action was called by "/library/books/ISBN/0743536703/show",  
    185   # we can redirect to an edit action simply by doing <tt>redirect_to(:action => "edit")</tt>, which could throw the user to  
    186   # "/library/books/ISBN/0743536703/edit". Naturally, you'll need to setup the routes configuration file to point to the proper controller 
    187   # and action in the first place, but once you have, it can be rewritten with ease. 
    188   #  
    189   # Let's consider a bunch of examples on how to go from "/clients/37signals/basecamp/project/dash" to somewhere else: 
    190   # 
    191   #   redirect_to(:action => "edit") => 
    192   #     /clients/37signals/basecamp/project/dash 
    193   #    
    194   #   redirect_to(:client_name => "nextangle", :project_name => "rails") => 
    195   #     /clients/nextangle/rails/project/dash 
    196   # 
    197   # Those redirects happen under the configuration of: 
    198   # 
    199   #   map.connect 'clients/:client_name/:project_name/:controller/:action' 
     174  # Redirects are used to move from one action to another. For example, after a <tt>create</tt> action, which stores a blog entry to a database, 
     175  # we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're going to reuse (and redirect to) 
     176  # a <tt>show</tt> action that we'll assume has already been created. The code might look like this: 
     177  # 
     178  #   def create 
     179  #     @entry = Entry.new(params[:entry]) 
     180  #     if @entry.save 
     181  #       # The entry was saved correctly, redirect to show 
     182  #       redirect_to :action => 'show', :id => @entry.id 
     183  #     else 
     184  #       # things didn't go so well, do something else 
     185  #     end 
     186  #   end 
     187  # 
     188  # In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method which is then executed. 
    200189  # 
    201190  # == Calling multiple redirects or renders 
     
    215204  #   end 
    216205  # 
    217   # == Environments 
    218   # 
    219   # Action Controller works out of the box with CGI, FastCGI, and mod_ruby. CGI and mod_ruby controllers are triggered just the same using: 
    220   # 
    221   #   WeblogController.process_cgi 
    222   # 
    223   # FastCGI controllers are triggered using: 
    224   # 
    225   #   FCGI.each_cgi{ |cgi| WeblogController.process_cgi(cgi) } 
    226206  class Base 
    227207    DEFAULT_RENDER_STATUS_CODE = "200 OK" 
     
    264244    # Modern REST web services often need to submit complex data to the web application.  
    265245    # The param_parsers hash lets you register handlers wich will process the http body and add parameters to the  
    266     # @params hash. These handlers are invoked for post and put requests. 
     246    # <tt>params</tt> hash. These handlers are invoked for post and put requests. 
    267247    # 
    268248    # By default application/xml is enabled. A XmlSimple class with the same param name as the root will be instanciated  
    269     # in the @params. This allows XML requests to mask themselves as regular form submissions, so you can have one 
     249    # in the <tt>params</tt>. This allows XML requests to mask themselves as regular form submissions, so you can have one 
    270250    # action serve both regular forms and web service requests. 
    271251    #  
     
    367347        write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s }) 
    368348      end 
     349       
     350      # Replace sensitive paramater data from the request log. 
     351      # Filters paramaters that have any of the arguments as a substring. 
     352      # Looks in all subhashes of the param hash for keys to filter. 
     353      # If a block is given, each key and value of the paramater hash and all 
     354      # subhashes is passed to it, the value or key 
     355      # can be replaced using String#replace or similar method. 
     356      # 
     357      # Examples: 
     358      #   filter_parameter_logging 
     359      #   => Does nothing, just slows the logging process down 
     360      # 
     361      #   filter_parameter_logging :password 
     362      #   => replaces the value to all keys matching /password/i with "[FILTERED]" 
     363      # 
     364      #   filter_parameter_logging :foo, "bar" 
     365      #   => replaces the value to all keys matching /foo|bar/i with "[FILTERED]" 
     366      # 
     367      #   filter_parameter_logging { |k,v| v.reverse! if k =~ /secret/i } 
     368      #   => reverses the value to all keys matching /secret/i 
     369      # 
     370      #   filter_parameter_logging(:foo, "bar") { |k,v| v.reverse! if k =~ /secret/i } 
     371      #   => reverses the value to all keys matching /secret/i, and  
     372      #      replaces the value to all keys matching /foo|bar/i with "[FILTERED]" 
     373      def filter_parameter_logging(*filter_words, &block) 
     374        parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0 
     375 
     376        define_method(:filter_parameters) do |unfiltered_parameters| 
     377          filtered_parameters = {} 
     378 
     379          unfiltered_parameters.each do |key, value| 
     380            if key =~ parameter_filter 
     381              filtered_parameters[key] = '[FILTERED]' 
     382            elsif value.is_a?(Hash) 
     383              filtered_parameters[key] = filter_parameters(value)  
     384            elsif block_given? 
     385              key, value = key.dup, value.dup 
     386              yield key, value 
     387              filtered_parameters[key] = value 
     388            else  
     389              filtered_parameters[key] = value 
     390            end 
     391          end 
     392 
     393          filtered_parameters 
     394        end 
     395      end 
    369396    end 
    370397 
     
    804831      # 
    805832      # The redirection happens as a "302 Moved" header. 
     833      # 
     834      # When using <tt>redirect_to :back</tt>, if there is no referrer, 
     835      # RedirectBackError will be raised. You may specify some fallback 
     836      # behavior for this case by rescueing RedirectBackError. 
    806837      def redirect_to(options = {}, *parameters_for_method_reference) #:doc: 
    807838        case options 
     
    902933          logger.info "\n\nProcessing #{controller_class_name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]" 
    903934          logger.info "  Session ID: #{@session.session_id}" if @session and @session.respond_to?(:session_id) 
    904           logger.info "  Parameters: #{@params.inspect}" 
     935          logger.info "  Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(@params).inspect : @params.inspect}" 
    905936        end 
    906937      end 
  • branches/stable/actionpack/lib/action_controller/caching.rb

    r4125 r4708  
    3939    #   class WeblogController < ActionController::Base 
    4040    #     def update 
    41     #       List.update(@params["list"]["id"], @params["list"]) 
    42     #       expire_page :action => "show", :id => @params["list"]["id"
    43     #       redirect_to :action => "show", :id => @params["list"]["id"
     41    #       List.update(params[:list][:id], params[:list]) 
     42    #       expire_page :action => "show", :id => params[:list][:id
     43    #       redirect_to :action => "show", :id => params[:list][:id
    4444    #     end 
    4545    #   end 
  • branches/stable/actionpack/lib/action_controller/cgi_process.rb

    r3989 r4708  
    6565 
    6666    def request_parameters 
    67       if ActionController::Base.param_parsers.has_key?(content_type) 
    68         CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA']) 
    69       else 
    70         CGIMethods.parse_request_parameters(@cgi.params) 
    71       end 
     67      @request_parameters ||= 
     68        if ActionController::Base.param_parsers.has_key?(content_type) 
     69          CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA']) 
     70        else 
     71          CGIMethods.parse_request_parameters(@cgi.params) 
     72        end 
    7273    end 
    7374    
  • branches/stable/actionpack/lib/action_controller/integration.rb

    r4161 r4708  
    141141      # Performs a GET request with the given parameters. The parameters may 
    142142      # be +nil+, a Hash, or a string that is appropriately encoded 
    143       # (application/x-www-form-urlencoded or multipart/form-data). 
     143      # (application/x-www-form-urlencoded or multipart/form-data).  The headers 
     144      # should be a hash.  The keys will automatically be upcased, with the  
     145      # prefix 'HTTP_' added if needed. 
    144146      def get(path, parameters=nil, headers=nil) 
    145147        process :get, path, parameters, headers 
     
    148150      # Performs a POST request with the given parameters. The parameters may 
    149151      # be +nil+, a Hash, or a string that is appropriately encoded 
    150       # (application/x-www-form-urlencoded or multipart/form-data). 
     152      # (application/x-www-form-urlencoded or multipart/form-data).  The headers 
     153      # should be a hash.  The keys will automatically be upcased, with the  
     154      # prefix 'HTTP_' added if needed. 
    151155      def post(path, parameters=nil, headers=nil) 
    152156        process :post, path, parameters, headers 
     
    156160      # the request environment created by the Prototype library. The parameters 
    157161      # may be +nil+, a Hash, or a string that is appropriately encoded 
    158       # (application/x-www-form-urlencoded or multipart/form-data). 
     162      # (application/x-www-form-urlencoded or multipart/form-data).  The headers 
     163      # should be a hash.  The keys will automatically be upcased, with the  
     164      # prefix 'HTTP_' added if needed. 
    159165      def xml_http_request(path, parameters=nil, headers=nil) 
    160166        headers = (headers || {}).merge("X-Requested-With" => "XMLHttpRequest") 
     
    219225          (headers || {}).each do |key, value| 
    220226            key = key.to_s.upcase.gsub(/-/, "_") 
    221             key = "HTTP_#{key}" unless env.has_key?(key) 
     227            key = "HTTP_#{key}" unless env.has_key?(key) || env =~ /^X|HTTP/ 
    222228            env[key] = value 
    223229          end 
     
    342348  # 
    343349  #   require "#{File.dirname(__FILE__)}/test_helper" 
    344   #   require "integration_test" 
    345350  # 
    346351  #   class ExampleTest < ActionController::IntegrationTest 
     
    367372  # 
    368373  #   require "#{File.dirname(__FILE__)}/test_helper" 
    369   #   require "integration_test" 
    370374  # 
    371375  #   class AdvancedTest < ActionController::IntegrationTest 
  • branches/stable/actionpack/lib/action_controller/layout.rb

    r3989 r4708  
    2828    # 
    2929    #   <!-- The header part of this layout --> 
    30     #   <%= @content_for_layout %> 
     30    #   <%= yield %> 
    3131    #   <!-- The footer part of this layout --> 
    3232    # 
     
    4848    # 
    4949    #   <h1><%= @page_title %></h1> 
    50     #   <%= @content_for_layout %> 
     50    #   <%= yield %> 
    5151    # 
    5252    # ...and content pages that fulfill these references _at_ rendering time: 
     
    160160    # As you can see, you pass the template as the first parameter, the status code as the second ("200" is OK), and the layout 
    161161    # as the third. 
     162    # 
     163    # NOTE: The old notation for rendering the view from a layout was to expose the magic <tt>@content_for_layout</tt> instance  
     164    # variable. The preferred notation now is to use <tt>yield</tt>, as documented above. 
    162165    module ClassMethods 
    163       # If a layout is specified, all actions rendered through render and render_action will have their result assigned  
    164       # to <tt>@content_for_layout</tt>, which can then be used by the layout to insert their contents with 
    165       # <tt><%= @content_for_layout %></tt>. This layout can itself depend on instance variables assigned during action 
     166      # If a layout is specified, all rendered actions will have their result rendered   
     167      # when the layout<tt>yield</tt>'s. This layout can itself depend on instance variables assigned during action 
    166168      # performance and have access to them as any normal template would. 
    167169      def layout(template_name, conditions = {}) 
  • branches/stable/actionpack/lib/action_controller/pagination.rb

    r3620 r4708  
    3232  # current page (at most 20, sorted by last name and first name), and a  
    3333  # <tt>@person_pages</tt> Paginator instance. The current page is determined 
    34   # by the <tt>@params['page']</tt> variable. 
     34  # by the <tt>params[:page]</tt> variable. 
    3535  # 
    3636  # ==== Pagination for a single action 
     
    4848  # 
    4949  #   def list 
    50   #     @person_pages = Paginator.new self, Person.count, 10, @params['page'
     50  #     @person_pages = Paginator.new self, Person.count, 10, params[:page
    5151  #     @people = Person.find :all, :order => 'last_name, first_name',  
    5252  #                           :limit  =>  @person_pages.items_per_page, 
  • branches/stable/actionpack/lib/action_controller/request.rb

    r3989 r4708  
    11module ActionController 
    2   # These methods are available in both the production and test Request objects. 
     2  # Subclassing AbstractRequest makes these methods available to the request objects used in production and testing, 
     3  # CgiRequest and TestRequest 
    34  class AbstractRequest 
    45    cattr_accessor :relative_url_root 
     
    6667    end 
    6768 
     69    # Returns the accepted MIME type for the request 
    6870    def accepts 
    6971      @accepts ||= 
     
    203205    end 
    204206 
    205     def path_parameters=(parameters) 
     207    def path_parameters=(parameters) #:nodoc: 
    206208      @path_parameters = parameters 
    207209      @symbolized_path_parameters = @parameters = nil 
    208210    end 
    209211 
    210     def symbolized_path_parameters 
     212    # The same as <tt>path_parameters</tt> with explicitly symbolized keys  
     213    def symbolized_path_parameters  
    211214      @symbolized_path_parameters ||= path_parameters.symbolize_keys 
    212215    end 
    213216 
     217    # Returns a hash with the parameters used to form the path of the request  
     218    # 
     219    # Example:  
     220    # 
     221    #   {:action => 'my_action', :controller => 'my_controller'} 
    214222    def path_parameters 
    215223      @path_parameters ||= {} 
  • branches/stable/actionpack/lib/action_controller/streaming.rb

    r2325 r4708  
    1515      # 
    1616      # Be careful to sanitize the path parameter if it coming from a web 
    17       # page.  send_file(@params['path']) allows a malicious user to 
     17      # page.  send_file(params[:path]) allows a malicious user to 
    1818      # download any file on your server. 
    1919      #