Commit Graph

38508 Commits

Author SHA1 Message Date
Steven Yang
42a3817cd6 unified the param names across all callbacks manipulation methods
_ Rename the define_callbacks params to `names`
  - in order to match the naming conventions for `get_callbacks` and `set_callbacks` at https://github.com/rails/rails/blob/master/activesupport/lib/active_support/callbacks.rb#L736-743
  - `define_callbacks` just register names(events), not define the real callback functions.
- Rename the `reset_callbacks` params
2013-07-01 07:38:31 +08:00
Cristian Planas
7451c2f7cc Adding find_by in guide to methods that trigger after_find 2013-07-01 01:27:44 +02:00
Carlos Antonio da Silva
51ed3fa638 Merge pull request #11192 from charliesome/extra-roflscale
Store a symbol directly inside DISPATCH_CACHE for additional roflscale
2013-06-30 15:55:44 -07:00
Steven Yang
6e583cdac3 fix typo in ActiveModel::Error docs [ci skip] 2013-06-30 18:38:29 -03:00
Carlos Antonio da Silva
9517aff899 Merge pull request #11196 from yangchenyun/remove_evals_in_am_callbacks
Remove evals from AM::Validations::Callbacks
2013-06-30 14:37:55 -07:00
Yves Senn
996f9b5873 Merge pull request #11186 from jetthoughts/synchronize_create_method_body
Synchronize PostController#create code from 5.6 to others sections in Getting Started guide.
2013-06-30 06:44:03 -07:00
Yves Senn
162cc66864 don't shadow through_scope method name with local var. 2013-06-30 14:40:45 +02:00
Steven Yang
5fe43ffcfb remove evals from AM::Validations::Callbacks
follow the same refactor at a63a964a5d1ed02cf0df1b1a33a96ed2a9fa987b
2013-06-30 18:47:55 +08:00
Paul Nikitochkin
bb8f0b401d Synchronize PostController#create code from 5.6 to others sections. [ci skip]
Fixed `permit` using for comments.
2013-06-30 13:34:11 +03:00
Yves Senn
4a9cf2e382 Merge pull request #11180 from robin850/patch-5
Remove a duplicated section [ci skip]
2013-06-30 03:12:28 -07:00
Yves Senn
e9ba6eca65 Merge pull request #11189 from jetthoughts/destroy_link_description_for_getting_started
Added clarification for destroy link_to description in 5.14
2013-06-30 03:09:31 -07:00
Yves Senn
bb1feb02e1 Merge pull request #11190 from dkaplan88/typo
Typo in Active Record Migrations Guide
2013-06-30 03:02:45 -07:00
Steven Yang
49fd826042 updated AS:Callbacks doc for terminator option in define_callbacks method
The change is commited at ba552764344bc0a3c25b8576ec11f127ceaa16da
2013-06-30 17:53:11 +08:00
Neeraj Singh
f319e4a942 Do not invoke callbacks when delete_all is called
Method `delete_all` should not be invoking callbacks and this
feature was deprecated in Rails 4.0. This is being removed.
`delete_all` will continue to honor the `:dependent` option. However
if `:dependent` value is `:destroy` then the default deletion
strategy for that collection will be applied.

User can also force a deletion strategy by passing parameter to
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)`
2013-06-30 14:50:18 +05:30
Santiago Pastorino
4eedb3928e Clean the code a bit 2013-06-29 21:20:08 -07:00
Charlie Somerville
5e356de271 store a symbol directly inside DISPATCH_CACHE for extra roflscale 2013-06-30 11:31:36 +10:00
dkaplan88
a0bdf2fff5 Typo in Active Record Migrations Guide [ci skip] 2013-06-29 17:38:30 -05:00
Paul Nikitochkin
17b01b8057 Added clarification for destroy link_to description in 5.14 [ci skip] 2013-06-30 00:33:12 +03:00
Robin Dupret
59efb76306 Remove a duplicated section [ci skip]
Attachments were previously covered so remove the useless part. Just
move a note about multipart headers set when the mail method is
triggered to the kept section.
2013-06-29 19:14:09 +02:00
Rafael Mendonça França
08f8c8aa52 Merge pull request #11176 from schneems/schneems/plugin_new_help_fix
Fix `rails plugin --help`
2013-06-29 07:53:30 -07:00
schneems
6ce18ba7dc Fix rails plugin --help
Right now if you run the `rails plugin --help` command it fails because rails expects a command in `railties/lib/rails/commands/plugin.rb` that does not exist because the file is named `plugin_new`. This is the error:

```
ruby-2.0.0-p0  ~/documents/projects/tmp/vanilla (master)
$ rails plugin --help
/Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- rails/commands/plugin (LoadError)
	from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
	from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
	from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
	from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0/lib/rails/commands.rb:49:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'
```
2013-06-29 14:34:46 +03:00
José Valim
3e0ce665e5 Merge pull request #11177 from yangchenyun/mine
provide a more sementic local variables name in ActiveModel::Validation::Clusivity
2013-06-29 04:07:13 -07:00
Rafael Mendonça França
7cf6637071 Merge pull request #11156 from JonRowe/fix_tags_picking_string_keys_from_non_stringified_options
Fetch value(s) from stringified options in tags that stringify options
2013-06-29 04:00:19 -07:00
Steven Yang
e8fe6660d2 provide a more sementicthe local variables name for ActiveModel::Validations::Clusivity#include? method
the original name `exclusion` is a bit confusing when using with the method `inclusion_method`
rename it to a more logic neutral name.
2013-06-29 18:36:40 +08:00
Steve Klabnik
396f23234a Merge pull request #11152 from senny/remove_implicit_join_references
remove deprecated implicit join references
2013-06-29 02:52:15 -07:00
Steve Klabnik
fba490737e Merge pull request #11175 from robin850/patch-4
Update a broken link into the fixtures' template [ci skip]
2013-06-29 02:48:35 -07:00
Robin Dupret
8564f0ae19 Update a broken link into the fixtures' template 2013-06-29 11:43:49 +02:00
Jon Rowe
53eb9fdd9c fetch value(s) from stringified options 2013-06-29 19:32:13 +10:00
Yves Senn
22b3481ba2 remove deprecated implicit join references. 2013-06-29 10:50:44 +02:00
Aaron Patterson
3f81230a72 use bytesize rather than force encoding 2013-06-28 17:21:38 -07:00
Aaron Patterson
1b6aa27320 writing the new body can cause the response to be committed and the
request thread to return up the stack before the instance variable is
assigned.  Synchronize so that the ivar is assigned before the other
thread can activate.

fixes #10984
2013-06-28 16:51:53 -07:00
Vijay Dev
572f9b665a Merge pull request #11160 from wangjohn/documentation_for_railties_initialization_guide
Adding documentation to the Rails initialization guide.
2013-06-28 12:07:42 -07:00
Carlos Antonio da Silva
6b745ec9ee Merge pull request #11163 from nfedyashev/omit_turbolinks_on_javascript_skip_option
Omit turbolinks configuration completely on skip_javascript generator option
2013-06-28 06:02:01 -07:00
Carlos Antonio da Silva
8f63515f6e Merge pull request #11161 from dmitry/find_in_batches_works_without_logger
ActiveRecord find_in_batches should work without logger

When I set logger to nil both methods from Batches module find_in_batches or find_each should work anyway.
2013-06-28 06:00:20 -07:00
Nikita Fedyashev
e68183cccb Omit turbolinks configuration completely on skip_javascript generator option 2013-06-28 18:53:32 +06:00
Carlos Antonio da Silva
5e6de3942f Remove order_values argument now that default_scope is simplified
In 94924dc32baf78f13e289172534c2e71c9c8cade the internal default_scope
implementation has changed making it simpler to follow, meaning that the
old usage of with_default_scope has been removed.

With that, order_values was the same argument for both calls to
find_first_with_limit, so remove it and use the existent attribute
for the sake of clarity/simplification.
2013-06-28 09:51:14 -03:00
Dmitry Polushkin
1cf6871a9e find_in_batches should work without logger 2013-06-28 13:51:00 +01:00
Jon Leighton
94924dc32b Simplify/fix implementation of default scopes
The previous implementation was necessary in order to support stuff
like:

    class Post < ActiveRecord::Base
      default_scope where(published: true)
      scope :ordered, order("created_at")
    end

If we didn't evaluate the default scope at the last possible moment
before sending the SQL to the database, it would become impossible to
do:

    Post.unscoped.ordered

This is because the default scope would already be bound up in the
"ordered" scope, and therefore wouldn't be removed by the
"Post.unscoped" part.

In 4.0, we have deprecated all "eager" forms of scopes. So now you must
write:

    class Post < ActiveRecord::Base
      default_scope { where(published: true) }
      scope :ordered, -> { order("created_at") }
    end

This prevents the default scope getting bound up inside the "ordered"
scope, which means we can now have a simpler/better/more natural
implementation of default scoping.

A knock on effect is that some things that didn't work properly now do.
For example it was previously impossible to use #except to remove a part
of the default scope, since the default scope was evaluated after the
call to #except.
2013-06-28 13:45:57 +01:00
Carlos Antonio da Silva
e66c148571 Merge pull request #11104 from drewda/patch-1
Adding additional plugins to debugging guide [ci skip]
2013-06-28 05:19:58 -07:00
Carlos Antonio da Silva
bd277ac6ef Fix layouts and rendering guide example using flash.now instead
Thanks @lintzchiang. [ci skip]
2013-06-28 09:08:24 -03:00
Jon Leighton
55193e449a Apply default scope when joining associations.
For example:

    class Post < ActiveRecord::Base
      default_scope -> { where published: true }
    end

    class Comment
      belongs_to :post
    end

When calling `Comment.join(:post)`, we expect to receive only
comments on published posts, since that is the default scope for
posts.

Before this change, the default scope from `Post` was not applied,
so we'd get comments on unpublished posts.
2013-06-28 11:47:00 +01:00
Jon Leighton
4642f5487a Fix test
Oops. We need to estalish/remove the connection in the setup/teardown,
else it messes with the fixtures.
2013-06-28 11:46:03 +01:00
Jon Leighton
cb8c950333 Fix rake test_sqlite3_mem
Clearly nobody uses this except me. It's fast people!
2013-06-28 11:37:42 +01:00
Jon Leighton
2ea7183799 Merge pull request #11153 from strzalek/remove-ar-deprecated-finders
Remove depreacted finders
2013-06-28 02:13:06 -07:00
Akira Matsuda
569227b091 Fix indentation 2013-06-28 16:39:43 +09:00
Drew Dara-Abrams
5a399dc6fa adding additional plugins for debugging [ci skip] 2013-06-27 20:35:21 -07:00
Carlos Antonio da Silva
9a26d94d60 Merge pull request #11150 from jetthoughts/remove_depr_message_for_attribute_method_matcher
Remove deprecation warning from AttributeMethodsMatcher
2013-06-27 17:48:14 -07:00
Łukasz Strzałkowski
3cc7223f3d Remove depreacted finders
They were deprecated in 4.0, planned to remove in 4.1
2013-06-28 00:24:11 +02:00
Paul Nikitochkin
e63ba910ae Remove deprecation warning from AttributeMethodsMatcher 2013-06-28 00:16:42 +03:00
Yves Senn
ca81874b3b Merge pull request #11127 from jetthoughts/ask_user_add_line_to_routes_in_guide
Asking user to declare post resource in getting start guide
2013-06-27 12:24:07 -07:00