Commit Graph

32292 Commits

Author SHA1 Message Date
Piotr Sarnacki
adf3ea3736 [guides] Add info about CHANGELOGs to contributing guide 2012-08-11 12:48:06 +02:00
Soon Van
457b7ff9af proper casing in pronouns; relocate the pro git book [ci skip]
- Cases in point - GitHub, Git, Twitter and Rails should start
  with capitals when used outside code context
- Pro Git found - URL has been updated for its new home
- Faces for links - More descriptive titles on link prompt
  instead of "here"
2012-08-11 02:19:51 -04:00
Carlos Antonio da Silva
56627b619c Merge branch 'number-helpers-defaults'
Closes #6290
2012-08-11 00:55:52 -03:00
Carlos Antonio da Silva
47b4d13c8d Ensure I18n format values always have precedence over defaults
Always merge I18n format values, namespaced or not, over the default
ones, to ensure I18n format defaults will have precedence over our
namespaced values.

Precedence should happen like this:

    default :format
    default :namespace :format
    i18n    :format
    i18n    :namespace :format

Because we cannot allow our namespaced default to override a I18n
:format config - ie precision in I18n :format should always have higher
precedence than our default precision for a particular :namespace.

Also simplify default format options logic.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
a9dccda936 Fallback to :en locale instead of handling a constant with defaults
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.

Closes #4420, #2802, #2890.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
b6e00c6764 Bring back changelog entries for Active Support
Removed in 0228a73b1094a3e19ad291d2ce4789890c09578a, pull request #7310.
2012-08-11 00:16:42 -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
Guillermo Iguaran
684b6482e4 Add doc for config.action_dispatch.default_headers
Add documentation for config.action_dispatch.default_headers to
Rails Configuring guide.
2012-08-10 22:00:50 -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
Franco Catena
4c711f1335 Fix caching guide (plural model name) [ci skip] 2012-08-10 21:51:07 -03:00
Jon Leighton
a63fc94aa3 fixup guides in light of :dependent changes 2012-08-10 23:45:25 +01:00
Jon Leighton
6e57d5c584 Use method compilation for association methods
Method compilation provides better performance and I think the code
comes out cleaner as well.

A knock on effect is that methods that get redefined produce warnings. I
think this is a good thing. I had to deal with a bunch of warnings
coming from our tests, though.
2012-08-10 23:28:08 +01: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
Jon Leighton
09d2671cb6 remove some artifacts of dependent_restrict_raises that I missed 2012-08-10 18:12:26 +01:00
Jon Leighton
6bb8afb45e DRY up handling of dependent option 2012-08-10 17:45:07 +01:00
Jon Leighton
825c05d491 Unprivatise all the things
Well, not all of them, but some of them.

I don't think there's much reason for these methods to be private.
2012-08-10 17:45:07 +01:00
Jon Leighton
ea8181b656 move dependency logic out of generated methods 2012-08-10 17:45:07 +01:00
Jon Leighton
08fb3c8f33 Clean up dependent option validation.
We don't need the complexity of to_sentence, and it shouldn't be a bang
method.
2012-08-10 17:45:07 +01:00
Jon Leighton
5ad79989ef Remove the dependent_restrict_raises option.
It's not really a good idea to have this as a global config option. We
should allow people to specify the behaviour per association.

There will now be two new values:

* :dependent => :restrict_with_exception implements the current
  behaviour of :restrict. :restrict itself is deprecated in favour of
  :restrict_with_exception.
* :dependent => :restrict_with_error implements the new behaviour - it
  adds an error to the owner if there are dependent records present

See #4727 for the original discussion of this.
2012-08-10 17:45:06 +01:00
Rafael Mendonça França
d1835db6b5 Merge pull request #7286 from kennyj/fix_7191
Fix #7191. Remove unnecessary transaction when assigning has_one associations.
2012-08-10 09:25:33 -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
Aaron Patterson
5a0372f7db Merge pull request #7315 from brainopia/fix_assertion
Fix mistake in assertion about content of permanent cookie
2012-08-09 23:06:22 -07: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
5c07be5f7f Merge pull request #7310 from amerine/master
Add html_escape note to CHANGELOG
2012-08-09 16:57:49 -07:00
Mark Turner
0228a73b10 Add html_escape note to CHANGELOG 2012-08-09 16:54:52 -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
schneems
e463351969 Document the namespacing of controller actions per this discussion:
https://github.com/rails/journey/issues/40
2012-08-09 10:10:39 -05: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
Aaron Patterson
2da242f63c Merge pull request #7293 from Bertg/activemodel_naming_helpers_try_model_name_first
Naming helpers should first check if passed object responds to model_name
2012-08-08 16:09:39 -07:00
Rafael Mendonça França
b8903f3606 Merge pull request #7294 from stevecj/fix-psql-reconnect-after-simulated-disconnect-test
Fix only-once stub logic.
2012-08-08 16:05:26 -07:00
Steve Jorgensen
1e17a9d367 Fix only-once stub logic.
Didn't fail the test because adapter#query happens to
not call raw connection's #query, but don't want to count
on that and have a fragile test.
2012-08-08 14:43:53 -07:00
David Heinemeier Hansson
ec923abe56 Remove highly uncommon option for moving the manifest path 2012-08-08 16:42:50 -05: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
Rafael Mendonça França
c0954a4802 Merge pull request #7292 from stevecj/fix-psql-reconnect-after-simulated-disconnect-test
Fix just-plain-wrongness of psql auto-reconnect test.
2012-08-08 14:09:25 -07:00
Bert Goethals
920d9ee4d8 Naming helpers should first check if passed object responds to model_name 2012-08-08 22:40:06 +02: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