Commit Graph

9246 Commits

Author SHA1 Message Date
David Heinemeier Hansson
0d0d46222c Add Request#formats=(extensions) that lets you set multiple formats directly in a prioritized order 2012-08-14 22:09:43 -05:00
Rafael Mendonça França
0bd7b07dff Add CHANGELOG entry and documentation for Routing Concerns 2012-08-13 21:43:18 -03:00
Rafael Mendonça França
546497d027 Extract common controllers to abstract_unit 2012-08-13 21:43:18 -03:00
Rafael Mendonça França
0dd24728a0 Implementing Routing Concerns
This pattern was introduced as a plugin by @dhh.

The original implementation can be found in
https://github.com/rails/routing_concerns
2012-08-13 21:41:53 -03:00
Aaron Patterson
38a3fed404 push header merge down to a private method so that live responses can have their own header object 2012-08-13 14:20:04 -04:00
Aaron Patterson
8f0541b702 live response headers can be merged with a hash 2012-08-13 13:57:26 -04:00
Evan Tann
1edc7cd78b Add support for start_hour and end_hour options in select_hour helper
Updated documentation to demonstrate start_hour and end_hour options
2012-08-13 12:26:23 -04:00
Edward Ocampo-Gooding
d9c9d685b6 Grammar fix in ActionView docs/comments 2012-08-12 17:26:13 -03:00
Ellis Berner
f7f70841b8 Missing closing tag 2012-08-12 11:26:56 -07:00
Carlos Antonio da Silva
a513cc1862 Ensure option_html_attributes does not modify the given option hashes
We can avoid creating extra hashes with #merge, and use #merge! instead.
2012-08-11 14:17:01 -03:00
Carlos Antonio da Silva
e8e8617c39 Simplify html attributes generation for options_for_select
Further simplify the option_html_attributes method after the changes
introduced in dacbcbe55745aa9e5484b10b11f65ccca7db1c54 to not escape the
html options here (since they're going to be escaped down the chain in
content tag).
2012-08-11 14:04:22 -03:00
Rafael Mendonça França
8781b266b9 Sync CHANGELOGs [ci skip] 2012-08-11 13:13:58 -03:00
Rafael Mendonça França
347f8c5325 Add CHANGELOG entry for #7314 2012-08-11 12:55:55 -03:00
Rafael Mendonça França
a6e0d8cfcf Merge pull request #7314 from schneems/schneems/form_for_error
Check for Blank Record in form_for
2012-08-10 20:09:21 -07:00
Rafael Mendonça França
feff27d38a Merge pull request #7329 from guilleiguaran/move-default-headers-ad-railtie
Move AD default_headers configurations to railtie
2012-08-10 20:08:09 -07:00
schneems
60b650b18c check for nil or empty record in form_for
if nil or an empty array is passed into form_for you get a horrible error message, this one is much more indicative of what the programmer needs to know to fix the problem.
2012-08-10 22:02:48 -05:00
Carlos Antonio da Silva
ac7e1700f1 Further refactor build_conditions in route set
Return the conditions from the keep_if call, and ignore the value
argument since it's not being used.
2012-08-10 23:58:47 -03:00
Guillermo Iguaran
c347236ce9 Move AD default_headers configurations to railtie
ActionDispatch railtie is a better place for
config.action_dispatch.default_headers settings, users can continue
overriding those settings in their configuration files if needed.
2012-08-10 21:11:56 -05:00
Piotr Sarnacki
5b3bb61f3f Fix handling SCRIPT_NAME from within mounted engine's
When you mount your application at a path, for example /myapp, server
should set SCRIPT_NAME to /myapp. With such information, rails
application knows that it's mounted at /myapp path and it should generate
routes relative to that path.

Before this patch, rails handled SCRIPT_NAME correctly only for regular
apps, but it failed to do it for mounted engines. The solution was to
hardcode default_url_options[:script_name], which is not the best answer
- it will work only when application is mounted at a fixed path.

This patch fixes the situation by respecting original value of
SCRIPT_NAME when generating application's routes from engine and the
other way round - when you generate engine's routes from application.

This is done by using one of 2 pieces of information in env - current
SCRIPT_NAME or SCRIPT_NAME for a corresponding router. This is because
we have 2 cases to handle:

- generating engine's route from application: in this situation
  SCRIPT_NAME is basically SCRIPT_NAME set by the server and it
  indicates the place where application is mounted, so we can just pass
  it as :original_script_name in url_options. :original_script_name is
  used because if we use :script_name, router will ignore generating
  prefix for engine

- generating application's route from engine: in this situation we
  already lost information about the SCRIPT_NAME that server used. For
  example if application is mounted at /myapp and engine is mounted at
  /blog, at this point SCRIPT_NAME is equal /myapp/blog. Because of that
  we need to keep reference to /myapp SCRIPT_NAME by binding it to the
  current router. Later on we can extract it and use when generating url

Please note that starting from now you *should not* use
default_url_options[:script_name] explicitly if your server already
passes correct SCRIPT_NAME to rack env.

(closes #6933)
2012-08-11 00:21:46 +02:00
Santiago Pastorino
f2557112a5 Merge pull request #7321 from bogdan/refactor_routes_set
RouteSet: refactor internals
2012-08-10 10:32:06 -07:00
Santiago Pastorino
0b11dbe2fe Add 'X-Frame-Options' => 'SAMEORIGIN' and 'X-XSS-Protection' => '1; mode=block' CHANGELOG entry 2012-08-10 13:19:09 -03:00
Bogdan Gusiev
79a0c8cf7f RouteSet: refactor internals
No need to build valid_conditions array.
We can get all the data in place.
2012-08-10 11:54:47 +03:00
brainopia
e157903310 Test actual content of permanent cookie 2012-08-10 09:48:26 +04:00
Aaron Patterson
581a927710 set the controller under test so we no longer need the reset! method 2012-08-09 18:06:13 -07:00
Santiago Pastorino
d8cf713afa Do not mark strip_tags result as html_safe
Thanks to Marek Labos & Nethemba

CVE-2012-3465
2012-08-09 18:51:05 -03:00
Aaron Patterson
c63d17c2be push drawing once to it's own module 2012-08-09 14:50:27 -07:00
Aaron Patterson
1e8c0a29d0 refactor the before_setup hooks to a module 2012-08-09 14:50:26 -07:00
Aaron Patterson
0b29c7bb7b switch callbacks to minitest hooks 2012-08-09 14:50:26 -07:00
Aaron Patterson
6794e92b20 Merge pull request #7302 from homakov/default_headers
Introduce default_headers. closes #6311 #6515
2012-08-09 13:38:29 -07:00
Aaron Patterson
6a3d4695f0 initialize instance variables 2012-08-09 11:21:58 -07:00
Egor Homakov
98c18d0058 some tests 2012-08-09 17:12:11 +03:00
Egor Homakov
2a290f7f7c introduce default_headers config 2012-08-09 16:45:30 +03:00
Aaron Patterson
37a764b8e0 use a sized buffer to prevent the queue being too large 2012-08-08 17:41:50 -07:00
David Heinemeier Hansson
b540f4c1b8 Allow data attributes to be set as a first-level option for form_for, so you can write form_for @record, data: { behavior: 'autosave' } instead of form_for @record, html: { data: { behavior: 'autosave' } } *DHH* 2012-08-08 16:36:46 -05:00
David Heinemeier Hansson
4154bf012d Modernize the documentation for view caching somewhat 2012-08-08 11:25:22 -05:00
Rafael Mendonça França
5d1528740a Deprecate button_to_function and link_to_function helpers.
We recommend the use of Unobtrusive JavaScript instead. For example:

  link_to "Greeting", "#", :class => "nav_link"

  $(function() {
    $('.nav_link').click(function() {
      // Some complex code

      return false;
    });
  });

or

  link_to "Greeting", '#', onclick: "alert('Hello world!'); return false", class: "nav_link"

for simple cases.

This reverts commit 3acdd652e9fe99481c879c84c5807a84eb9ad724.
2012-08-07 20:57:42 -03:00
David Heinemeier Hansson
7dedfded4a Remove antiquated example code 2012-08-07 18:11:42 -05:00
David Heinemeier Hansson
42c308818b Remove outdated examples and feature highlights 2012-08-07 18:11:42 -05:00
David Heinemeier Hansson
666d3fd0c1 Revert "Merge pull request #7033 from kron4eg/master". Not a a fan at all of what this makes ERB files look like.
This reverts commit 46b8bceedd3e47169c50a04c93161424909c75fb, reversing
changes made to 2f58795e783150f2e1b1f6c64e305703f0061129.
2012-08-07 11:44:24 -05:00
Artiom Di
e82ffeaa0a Restoring the '%' trim mode for ERb templates, allowing for a leading percent sign on a line to indicate non-inserted Ruby code. 2012-08-07 12:37:56 +03:00
Prem Sichanugrist
0c4c7d94ed Rearrange example output of javascript_include_tag 2012-08-06 16:45:59 -04:00
Prem Sichanugrist
02c9654b9b Do not include application.js if it doesn't exists
Rails were including 'application.js' to the pack when using
`javascript_include_tag :all` even there's no application.js in the
public directory.
2012-08-06 16:45:10 -04:00
Rafael Mendonça França
5edfc46348 Don't use html_escape to test the escaping 2012-08-05 21:21:14 -03:00
Rafael Mendonça França
39f4f28993 Add CHANGELOG entry for 3c731a4ad62430100ba0b65bc966aa6dc6280c5f 2012-08-05 21:12:57 -03:00
Xavier Noria
447b6a4e67 removes usage of Object#in? from the code base (the method remains defined by Active Support)
Selecting which key extensions to include in active_support/rails
made apparent the systematic usage of Object#in? in the code base.
After some discussion in

    5ea6b0df9a

we decided to remove it and use plain Ruby, which seems enough
for this particular idiom.

In this commit the refactor has been made case by case. Sometimes
include? is the natural alternative, others a simple || is the
way you actually spell the condition in your head, others a case
statement seems more appropriate. I have chosen the one I liked
the most in each case.
2012-08-06 00:30:02 +02:00
Andrew White
c5807728d5 Revert "polymorphic_url with an array generates a query string"
Passing options as the last value in an array doesn't work with form_for.
This reverts commit 61c8a4d926343903593a27080216af7e4ed81268.
2012-08-04 19:02:58 +01:00
Andrew White
4059423809 Revert "Refactor passing url options via array for polymorphic_url"
Passing options as the last value in an array doesn't work with form_for.
This reverts commit 6be564c7a087773cb0b51c54396cc190e4f5c983.
2012-08-04 19:02:57 +01:00
Bogdan Gusiev
9e03c6aab3 RouteSet: cleanup some unneeded compexity 2012-08-04 15:11:10 +03:00
Bogdan Gusiev
d89161e7cc Renamed _path_segments to _recall 2012-08-04 14:55:00 +03:00
Bogdan Gusiev
422b3d70d5 Simplify logical statement 2012-08-04 14:24:35 +03:00