aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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 ```
* | Merge pull request #15812 from crankharder/remove_postgres_adapter_methodRafael Mendonça França2014-06-191-4/+0
|\ \ | |/ |/| remove unused method from Postgresql::Adapter
| * this method is no longer being usedJosh Sharpe2014-06-191-4/+0
|/
* Merge pull request #15795 from amitsuryavanshi/masterRafael Mendonça França2014-06-183-3/+3
|\ | | | | Titling the model name in views generated by scaffold.
| * Titling the model name in views generated by scaffold.Amit Suryavanshi2014-06-183-3/+3
| | | | | | | | | | eg. rails g scaffold UserProfile will have in index.html.erb "Listing User Profiles" rather than Listing user_profiles.
* | Merge pull request #15799 from ↵Yves Senn2014-06-1810-122/+47
|\ \ | |/ |/| | | | | zuhao/refactor_activesupport_time_zone_test_helpers Extract out with_env_tz helper method.
| * Extract out with_env_tz helper method.Zuhao Wan2014-06-1810-122/+47
| | | | | | | | | | It’s used at so many places that extracting it out into a helper file is worth doing.
* | Merge pull request #15709 from zuhao/refactor_actionview_compiled_templates_testYves Senn2014-06-181-8/+1
|\ \ | | | | | | Move cleanup into teardown, delete obsolete code.
| * | Move cleanup into teardown, delete obsolete code.Zuhao Wan2014-06-141-8/+1
| | |
* | | Reconnect after possibly enabling hstoreMatthew Draper2014-06-181-0/+2
| | |
* | | Merge pull request #15782 from sgrif/sg-column-defaultsMatthew Draper2014-06-1817-68/+60
|\ \ \ | | | | | | | | Don't type cast the default on the column
| * | | Don't type cast the default on the columnSean Griffin2014-06-1717-68/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
* | | | Merge pull request #15790 from sgrif/sg-mutable-pointsRafael Mendonça França2014-06-173-3/+31
|\ \ \ \ | | | | | | | | | | Detect in-place changes on point types
| * | | | Detect in-place changes on point typesSean Griffin2014-06-173-3/+31
| | | | |
* | | | | Deprecate Rails::Rack::LogTailerRafael Mendonça França2014-06-172-0/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was being used by Rails for show the development logs but since Rails 4 it is not being used anymore on the framework. This class seems to be private but it were part of the public API we are deprecating before removing.
* | | | Merge pull request #15789 from sgrif/sg-enable-hstoreRafael Mendonça França2014-06-171-0/+6
|\ \ \ \ | | | | | | | | | | Enable hstore in array tests
| * | | | Enable hstore in array testsSean Griffin2014-06-171-0/+6
|/ / / /
* | | | Merge pull request #15786 from sgrif/sg-in-place-array-mutationRafael Mendonça França2014-06-173-12/+41
|\ \ \ \ | | | | | | | | | | Detect mutations of arrays and array members
| * | | | Detect mutations of arrays and array membersSean Griffin2014-06-173-12/+41
|/ / / /
* | | | initialize the right variableRafael Mendonça França2014-06-171-1/+1
| | | |
* | | | :scissors:Rafael Mendonça França2014-06-171-8/+8
| | | |
* | | | Add a generic --skip-gems options to generatorRafael Mendonça França2014-06-173-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also remove --skip-turbolinks. This option is useful if users want to remove some gems like jbuilder, turbolinks, coffee-rails, etc that don't have specific options on the generator. rails new my_app --skip-gems turbolinks coffee-rails
* | | | Merge pull request #15784 from sgrif/sg-delimiterRafael Mendonça França2014-06-174-7/+54
|\ \ \ \ | | | | | | | | | | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behavior
| * | | | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-174-7/+54
|/ / / / | | | | | | | | | | | | | | | | | | | | Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
* | | | Merge pull request #15778 from sgrif/sg-pg-mutable-arraysMatthew Draper2014-06-184-38/+62
|\ \ \ \ | | | | | | | | | | Move pg array database type casting to the Array type
| * | | | Move array database type casting to the Array typeSean Griffin2014-06-174-38/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The case where we have a column object, but don't have a type cast method involves type casting the default value when changing the schema. We get one of the column definition structs instead. That is a case that I'm trying to remove overall, but in the short term, we can achieve the same behavior without needing to pass the adapter to the array type by creating a fake type that proxies to the adapter.
* | | | | Merge pull request #15716 from schuetzm/skip-turbolinksRafael Mendonça França2014-06-172-2/+21
|\ \ \ \ \ | | | | | | | | | | | | Add an option to skip installation of Turbolinks
| * | | | | Add an option to skip installation of TurbolinksMarc Schütz2014-06-142-2/+21
| | | | | |
* | | | | | Merge pull request #15727 from aditya-kapoor/add-tests-for-migrationMatthew Draper2014-06-181-0/+17
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | Add test cases for Migration#inverse_of
| * | | | | Add test cases for Migration#inverse_ofAditya Kapoor2014-06-171-0/+17
| | | | | |
* | | | | | Fix documentation from #15669 [ci skip]Zachary Scott2014-06-171-3/+5
| | | | | |
* | | | | | [ci skip] fix doc for the Hash#assert_valid_keysAditya Kapoor2014-06-171-3/+3
| | | | | |
* | | | | | Merge pull request #15780 from sgrif/sg-dont-always-save-mutable-typesRafael Mendonça França2014-06-173-2/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Don't assume that Hstore columns have always changed
| * | | | | | Don't assume that Hstore columns have always changedSean Griffin2014-06-173-2/+4
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
* | | | | | Merge pull request #15775 from sgrif/sg-use-column-defaults-in-dirtyRafael Mendonça França2014-06-171-11/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Use `column_defaults` in dirty for checking changed defaults
| * | | | | Use `column_defaults` in dirty for checking changed defaultsSean Griffin2014-06-171-11/+3
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | We no longer need to "init changed attributes" from the initializer, either, as there is no longer a case where a given value would differ from the default, but would not already be marked as changed.
* | | | | Merge pull request #15771 from sgrif/sg-stop-messing-with-column-defaultsRafael Mendonça França2014-06-173-12/+32
|\ \ \ \ \ | | | | | | | | | | | | Don't mess with `column_defaults` when optimistic locking is enabled
| * | | | | Don't mess with `column_defaults` when optimistic locking is enabledSean Griffin2014-06-173-12/+32
|/ / / / /
* | | | | Merge pull request #15768 from zuhao/refactor_activesupport_concern_testYves Senn2014-06-171-1/+2
|\ \ \ \ \ | |_|_|_|/ |/| | | | Move test teardown into `ensure` block.
| * | | | Move test teardown into `ensure` block.Zuhao Wan2014-06-171-1/+2
|/ / / /
* | | | add `bin/rake db:purge` task to empty the current database.Yves Senn2014-06-174-0/+55
| | | |
* | | | fix typo in test method names. [ci skip]Yves Senn2014-06-171-4/+4
| | | |
* | | | Merge pull request #15765 from rahul100885/masterYves Senn2014-06-171-3/+3
|\ \ \ \ | | | | | | | | | | [ci skip] doc corrected : ActiveRecord::Base.connections to ActiveRecord::Base.configurations