aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #15764 from arthurnn/dependencies_name_errorMatthew Draper2014-06-213-5/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Make dependencies.rb add a name to NameError
| * | | | | | Add regression test for NameError#nameArthur Neves2014-06-202-2/+5
| | | | | | |
| * | | | | | Make dependencies.rb add a name to NameErrorArthur Neves2014-06-202-4/+7
|/ / / / / /
* | | | | | docs, configurations method is listed in the docs. [ci skip]Yves Senn2014-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The :singleton-method: directive is printed in the docs. This directive is not necessary as the method is documentable just fine.
* | | | | | Merge pull request #15809 from maurogeorge/guides-console-appYves Senn2014-06-201-0/+25
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add to guides app and helper objects on command line
| * | | | | | Add to guides app and helper objects on command lineMauro George2014-06-191-0/+25
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | [ci skip]
* | | | | | Merge pull request #15537 from tgxworld/fix_state_leakMatthew Draper2014-06-204-5/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix state leak.
| * | | | | | Remove redundant code.Guo Xiang Tan2014-06-051-4/+0
| | | | | | |
| * | | | | | Prevent state leak.Guo Xiang Tan2014-06-054-1/+5
| | | | | | |
* | | | | | | Merge pull request #15824 from bhicks/remove-extra-list-item-elementSean Griffin2014-06-191-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Remove extra list item element in engine guide
| * | | | | | | Remove extra list item elementBen Hicks2014-06-191-1/+1
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleaning up the list items that detail what an engines `--full` option generates. Joining a multiline multi list item into a multiline single list item. [ci skip]
* | | | | | | add both branches to the only_path conditionalAaron Patterson2014-06-191-6/+6
| | | | | | |
* | | | | | | Merge pull request #15728 from sgrif/sg-double-save-hm-tRafael Mendonça França2014-06-193-4/+30
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't save through records twice Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/has_many_through_associations_test.rb
| * | | | | | | Don't save through records twiceSean Griffin2014-06-173-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the through record gets created in an `after_create` hook that is defined before the association is defined (therefore after its `after_create` hook) get saved twice. This ensures that the through records are created only once, regardless of the order of the hooks.
* | | | | | | | Merge pull request #15823 from ↵Rafael Mendonça França2014-06-191-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | yuki24/better-docmentation-for-dynamic-error-pages ErrorsController shouldn't inherit ApplicationController, but ActionController
| * | | | | | | | ErrorsController shouldn't inherit ApplicationController, but ↵Yuki Nishijima2014-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActionController::Base Inheriting `ApplicationController` often causes an issue as it always has before/after actions. It should encourage to use `ActionController::Base` instead. [ci skip]
* | | | | | | | | Merge pull request #15747 from sgrif/sg-trolololol-this-is-so-brokenRafael Mendonça França2014-06-193-1/+56
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Always update counter caches in memory when adding records
| * | | | | | | | | Always update counter caches in memory when adding recordsSean Griffin2014-06-163-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, calling `size` would only work if it skipped the cache, and would return a different result from the cache, but only if: - The association was previously loaded - Or you called size previously - But only if the size was 0 when you called it This ensures that the counter is appropriately updated in memory.
* | | | | | | | | | Merge pull request #15800 from sgrif/sg-column-in-calculationRafael Mendonça França2014-06-192-17/+8
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Don't use `Column` for type casting in Relation calculations
| * | | | | | | | | | Don't use `Column` for type casting in Relation calculationsSean Griffin2014-06-182-17/+8
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #15801 from sgrif/sg-column-defaultsRafael Mendonça França2014-06-191-2/+2
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Don't use column object when calculating type cast defaults
| * | | | | | | | | | | Don't use column object when calculating type cast defaultsSean Griffin2014-06-181-2/+2
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moves towards removing type casting knowledge from the column entirely
* | | | | | | | | | | Merge pull request #15802 from sgrif/sg-column-quotingRafael Mendonça França2014-06-193-31/+6
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Don't use column object for type casting in `quoting`
| * | | | | | | | | | | Don't use column object for type casting in `quoting`Sean Griffin2014-06-183-31/+6
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're never going to be able to use the attribute object here, however, so let's just accept the ugly demeter violation here for now. Remove test cases which were either redundant with other tests in the file, or were actually testing the type objects (which are tested elsewhere)
* | | | | | | | | | | Merge pull request #15803 from sgrif/sg-column-in-associationsRafael Mendonça França2014-06-193-5/+5
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Don't rely on the column for type casting reflections
| * | | | | | | | | | | Don't rely on the column for type casting reflectionsSean Griffin2014-06-183-5/+5
| |/ / / / / / / / / /
* | | | | | | | | | | Merge pull request #15814 from sgrif/sg-number-changedRafael Mendonça França2014-06-191-12/+6
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / / / |/| | | | | | | | | | Further simplify `changed?` conditional for numeric types
| * | | | | | | | | | Further simplify `changed?` conditional for numeric typesSean Griffin2014-06-191-12/+6
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Type::Integer.new.type_cast('') # => nil`, we do not need a special case to handle this, `nil => ''` already returns false. The only case we need to handle is `0 => 'wibble'` should be changed, while `0 => '0'` should not.
* | | | | | | | | | Merge pull request #15450 from aditya-kapoor/remove-nbsp-debugRafael Mendonça França2014-06-192-7/+7
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | remove unnecessary gsub for space in ActionView::Helpers#debug
| * | | | | | | | | | remove unnecessary substitution for space in ActionView::Helpers#debugAditya Kapoor2014-06-142-7/+7
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #15818 from sgrif/sg-attribute-setRafael Mendonça França2014-06-198-23/+120
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Introduce an object to aid in creation and management of `@attributes`
| * | | | | | | | | | | Introduce an object to aid in creation and management of `@attributes`Sean Griffin2014-06-198-23/+120
| | |/ / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly delegation to start, but we can start moving a lot of behavior in bulk to this object.
* | | | | | | | | | | Merge pull request #15808 from maurogeorge/guides-custom-errors-pageEileen M. Uchitelle2014-06-191-0/+55
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Create custom errors page on ActionController guides
| * | | | | | | | | | | Create custom errors page on ActionController guidesMauro George2014-06-191-0/+55
| | |_|_|_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | | | | | Merge pull request #15820 from lucasmazza/lm-except-highlight-tweaksRafael Mendonça França2014-06-193-7/+50
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | highlight/except support for regular expressions and blocks.
| * | | | | | | | | | | 'TextHelper#highlight' now accepts a block to highlight the matched words.Lucas Mazza2014-06-193-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The helper will yield each matched word, and you can use this instead of the ':highlighter' option for more complex replacing logic: highlight('My email is me@work.com', EMAIL_REGEXP) { |m| mail_to(m) } # => 'My email is <a href="mailto:me@work.com">me@work.com</a>'
| * | | | | | | | | | | highlight() now accepts regular expressions as well.Jan Szumiec2014-06-192-5/+15
| | | | | | | | | | | |
| * | | | | | | | | | | excerpt() now accepts regular expression instances as phrases.Jan Szumiec2014-06-192-3/+9
| | | | | | | | | | | |
* | | | | | | | | | | | Merge pull request #15772 from nbudin/sti_through_bugRafael Mendonça França2014-06-193-1/+18
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't include inheritance column in the through_scope_attributes
| * | | | | | | | | | | | Don't include inheritance column in the through_scope_attributesNat Budin2014-06-173-2/+17
| | | | | | | | | | | | |
* | | | | | | | | | | | | Use a better test descriptionRafael Mendonça França2014-06-191-1/+1
| | | | | | | | | | | | |
* | | | | | | | | | | | | Fix has_and_belongs_to_many in a namespaced model pointing to a non ↵Rafael Mendonça França2014-06-194-8/+20
| |/ / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespaced model Now the following case will work fine class Tag < ActiveRecord::Base end class Publisher::Article < ActiveRecord::Base has_and_belongs_to_many :tags end Fixes #15761
* | | | | | | | | | | | Merge pull request #15817 from zoombody/patch-1Rafael Mendonça França2014-06-191-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Fix typo in 4.1 upgrade/flash structure
| * | | | | | | | | | | | [ci skip] Fix typo in 4.1 upgrade/flash structureDan Rice2014-06-191-1/+1
|/ / / / / / / / / / / /
* | | | | | | | | | | | Merge pull request #15813 from DNNX/valid-action-name-refactoringRafael Mendonça França2014-06-191-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Relpace `=~ Regexp.new str` with `.include? str` in `_valid_action_name?`
| * | | | | | | | | | | | Relpace `=~ Regexp.new str` with `.include? str` in AC::Base#_valid_action_name?Viktar Basharymau2014-06-191-1/+1
| | |/ / / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because it is more natural way to test substring inclusion. Also, in this particular case it is much faster. In general, using `Regexp.new str` for such kind of things is dangerous. The string must be escaped, unless you know what you're doing. Example: Regexp.new "\\" # HELLO WINDOWS # RegexpError: too short escape sequence: /\/ The right way to do this is escape the string Regexp.new Regexp.escape "\\" # => /\\/ Here is the benchmark showing how faster `include?` call is. ``` require 'benchmark/ips' Benchmark.ips do |x| x.report('include?') { !"index".to_s.include? File::SEPARATOR } x.report(' !~ ') { "index" !~ Regexp.new(File::SEPARATOR) } end __END__ Calculating ------------------------------------- include? 75754 i/100ms !~ 21089 i/100ms ------------------------------------------------- include? 3172882.3 (±4.5%) i/s - 15832586 in 5.000659s !~ 322918.8 (±8.6%) i/s - 1602764 in 4.999509s ``` Extra `.to_s` call is needed to handle the case when `action_name` is `nil`. If it is omitted, some tests fail.
* | | | | | | | | | | | Merge pull request #15815 from DNNX/mail-helper-refactoringRafael Mendonça França2014-06-191-2/+2
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused block parameter from #gsub call in AM::MailHelper#block_format
| * | | | | | | | | | | | Remove unused block parameter from #gsub call in AM::MailHelper#block_formatViktar Basharymau2014-06-191-2/+2
| |/ / / / / / / / / / /
* | | | | | | | | | | | Merge pull request #15816 from DNNX/log-subscriber-add-debug-checkRafael Mendonça França2014-06-191-0/+1
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Add `logger.debug?` guard to `ActionMailer::LogSubscriber#process`
| * | | | | | | | | | | | Add `logger.debug?` guard to `ActionMailer::LogSubscriber#process`Viktar Basharymau2014-06-191-0/+1
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *TLDR*: The method is 4 times faster when log level is higher than DEBUG. Also, the other two methods, `#deliver` and `#receive` have similar guard statements, so this commit adds some symmetry to the code. This is probably not the most critical part of ActionMailer in terms of performance, but here are some benchmarks: ``` require 'benchmark/ips' require 'action_mailer' event = ActiveSupport::Notifications::Event.new( 'process.action_mailer', Time.now, Time.now, 'bf4e2b36ce085fd35b24', { mailer: "UserMailer", action: :welcome } ) ActionMailer::Base.logger = ActiveSupport::Logger.new '/dev/null' subscriber = ActionMailer::LogSubscriber.new def subscriber.process_with_guard(event) return unless logger.debug? mailer = event.payload[:mailer] action = event.payload[:action] debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms") end Benchmark.ips do |r| ActionMailer::Base.logger.level = ::Logger::Severity::INFO r.report('no guard') { subscriber.process(event) } r.report(' guard') { subscriber.process_with_guard(event) } end __END__ Calculating ------------------------------------- no guard 9640 i/100ms guard 38381 i/100ms ------------------------------------------------- no guard 169166.9 (±10.2%) i/s - 838680 in 5.007262s guard 728184.9 (±9.6%) i/s - 3607814 in 4.999218s ``` When log level is DEBUG, the _guarded_ method is a bit slower. This is a good tradeoff for 4x improvement in production mode. ``` Benchmark.ips do |r| ActionMailer::Base.logger.level = ::Logger::Severity::DEBUG r.report('no guard') { subscriber.process(event) } r.report(' guard') { subscriber.process_with_guard(event) } end __END__ Calculating ------------------------------------- no guard 4970 i/100ms guard 4564 i/100ms ------------------------------------------------- no guard 55617.4 (±3.5%) i/s - 278320 in 5.010523s guard 49452.1 (±5.6%) i/s - 251020 in 5.093358s ```