aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Speed up xor_byte_strings by 70%Jeremy Evans2018-05-181-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benchmark: ```ruby require 'benchmark' require 'benchmark/ips' require 'securerandom' def xor_byte_strings(s1, s2) # :doc: s2_bytes = s2.bytes s1.each_byte.with_index { |c1, i| s2_bytes[i] ^= c1 } s2_bytes.pack("C*") end def xor_byte_strings_new(s1, s2) # :doc: s2 = s2.dup size = s1.bytesize i = 0 while i < size s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i)) i += 1 end s2 end s1 = SecureRandom.random_bytes(32) s2 = SecureRandom.random_bytes(32) Benchmark.ips do |x| x.report("current"){xor_byte_strings(s1, s2)} x.report("new"){xor_byte_strings_new(s1, s2)} x.compare! end 100000.times do |i| s3 = SecureRandom.random_bytes(32) s4 = SecureRandom.random_bytes(32) raise unless xor_byte_strings(s3, s4) == xor_byte_strings_new(s3, s4) end ``` Results on ruby 2.5.1: ``` Warming up -------------------------------------- current 6.519k i/100ms new 10.508k i/100ms Calculating ------------------------------------- current 84.723k (_ 0.4%) i/s - 423.735k in 5.001456s new 145.871k (_ 0.3%) i/s - 735.560k in 5.042606s Comparison: new: 145870.6 i/s current: 84723.4 i/s - 1.72x slower ```
* Merge pull request #32900 from ttanimichi/app-update-skip-yarnRafael França2018-05-184-3/+25
|\ | | | | Don't generate yarn's contents in `app:update` task if it's skipped
| * Don't generate yarn's contents in `app:update` task if it's skippedTsukuru Tanimichi2018-05-164-3/+25
| |
* | Merge pull request #32925 from Linuus/fix/actioncontroller-params-fetch-docsRafael França2018-05-181-1/+3
|\ \ | | | | | | Fix documentation for ActionController::Params#fetch
| * | Fix documentation for ActionController::Params#fetchLinus Marton2018-05-181-1/+3
| | | | | | | | | | | | | | | Make it clear that the return value is converted to an instance of ActionController::Parameters if possible
* | | Raise a better exception when a invalid depreation behavior is setRafael Mendonça França2018-05-182-0/+12
|/ / | | | | | | Fixes #32928.
* | Permit opening a blob in a custom tempdirGeorge Claghorn2018-05-175-9/+26
| |
* | Merge pull request #32921 from joshsusser/masterRafael França2018-05-173-2/+62
|\ \ | | | | | | Generate ActiveStorage attachment getter and setter methods in mixin
| * | Generate getter and setter methods in mixinJosh Susser2018-05-173-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generated attachment getter and setter methods are created within the model's `GeneratedAssociationMethods` module to allow overriding and composition using `super`. Includes tests for new functionality. Co-authored-by: Josh Susser <josh@hasmanythrough.com> Co-authored-by: Jamon Douglas <terrildouglas@gmail.com>
* | | Fix markdown [ci skip]Rafael Mendonça França2018-05-171-1/+1
|/ /
* | Merge pull request #32908 from anniecodes/fix-time-random-stringRafael França2018-05-174-0/+28
|\ \ | | | | | | Fix user_input_in_time_zone to coerce non valid string into nil
| * | Fix user_input_in_time_zone to coerce non valid string into nilAnnie-Claude Côté2018-05-163-0/+27
| | | | | | | | | | | | Before it was coercing an invalid string into "2000-01-01 00:00:00".
| * | Add missing require for string to timezone conversionAnnie-Claude Côté2018-05-161-0/+1
| | | | | | | | | | | | Inside user_input_in_time_zone we call in_time_zone on the value and value can be a String.
* | | Fix formatting of author credit [ci skip]Ryuta Kamizono2018-05-171-1/+1
| | |
* | | Merge pull request #32916 from lucfranken/patch-1Ryuta Kamizono2018-05-171-1/+1
|\ \ \ | | | | | | | | | | | | | | | | Active storage: Image variant options not correct in docs [ci skip]
| * | | Active storage: Image variant options not correctlucfranken2018-05-171-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Steps to reproduce Using Rails 5.2.0 When following this example: http://api.rubyonrails.org/classes/ActiveStorage/Variant.html `avatar.variant(resize: "100x100", monochrome: true, flip: "-90")` ### Expected behavior Image should be rendered as flipped. ### Actual behavior I get an error: > failed with error: gm mogrify: Unrecognized option (-90). ### Fix: According to: https://github.com/minimagick/minimagick the option should be called rotate: `avatar.variant(resize: "100x100", monochrome: true, rotate: "-90")` So **flip** changed to **rotate**. ### System configuration **Rails version**: 5.2.0 **Ruby version**: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
* | | Remove unused `require "active_support/core_ext/string/filters"`Ryuta Kamizono2018-05-171-2/+0
| | |
* | | Add ActiveStorage::Previewer#tempdirGeorge Claghorn2018-05-161-1/+5
| | |
* | | Add missing block parametersGeorge Claghorn2018-05-162-2/+2
| | |
* | | Demonstrate ActiveStorage::Blob#open in the Active Storage guideGeorge Claghorn2018-05-161-42/+9
| | |
* | | Add ActiveStorage::Blob#openGeorge Claghorn2018-05-168-12/+81
| |/ |/| | | | | [David Robertson & George Claghorn]
* | Don't expose `SingularAssociation#replace` which is internal APIRyuta Kamizono2018-05-163-47/+44
|/ | | | | Originally `SingularAssociation#replace` abstract method is private, and doesn't intend to be called directly.
* Remove :nodoc: from the methods which is added the doc [ci skip]Ryuta Kamizono2018-05-151-4/+4
| | | | Follow up of #19171 and #26825.
* Merge pull request #32724 from nikolai-b/add_math_testRyuta Kamizono2018-05-152-9/+83
|\ | | | | Add math test
| * Add math testsNikolai B2018-05-142-9/+83
|/ | | | | | After #449 was merged math can be done on these nodes, adding a test file to unit test all the math operators.
* Merge pull request #32837 from ttanimichi/app-update-skip-springYuji Yaginuma2018-05-143-1/+17
|\ | | | | Don't generate `config/spring.rb` in `app:update` task when spring isn't loaded
| * Don't generate `config/spring.rb` in `app:update` task when spring isn't loadedTsukuru Tanimichi2018-05-133-1/+17
| |
* | Merge pull request #32876 from wata727/add_available_transformationsGeorge Claghorn2018-05-131-0/+3
|\ \ | | | | | | Add available transformations to docs
| * | Add available transformations to docs [ci skip]wata_mac2018-05-131-0/+3
| | | | | | | | | | | | `foreign_key`, `json` and `virtual` are also available.
* | | Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-1345-143/+143
| | | | | | | | | | | | Follow up of #32605.
* | | Merge pull request #32878 from eugeneius/rm_rollback_active_record_stateRyuta Kamizono2018-05-131-14/+1
|\ \ \ | | | | | | | | Remove ActiveRecord::Transactions#rollback_active_record_state!
| * | | Remove ActiveRecord::Transactions#rollback_active_record_state!Eugene Kenny2018-05-131-14/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `rollback_active_record_state!` was removed from `save!` but not `save` in da840d13da865331297d5287391231b1ed39721b. I believe that leaving it in `save` was a mistake, since that commit was intended to move the rollback logic from the `save`/`save!` call to the transaction stack. As of 67d8bb963d5d51fc644d6b1ca20164efb4cee6d7 the record's original state is lazily restored the first time it's accessed after the transaction, instead of when a rollback occurs. This means that the call to `restore_transaction_record_state` here has no effect: the record's transaction level is incremented twice (in rollback_active_record_state! and `with_transaction_returning_status`), isn't decremented again until the the `ensure` block runs, and won't hit zero until the next time `sync_with_transaction_state` is called.
* | | Merge pull request #32862 from eugeneius/callback_rollbackRyuta Kamizono2018-05-132-7/+13
|\ \ \ | |/ / |/| | Don't clear transaction state after manual rollback
| * | Don't clear transaction state after manual rollbackEugene Kenny2018-05-102-7/+13
| | | | | | | | | | | | | | | | | | | | | If an `ActiveRecord::Rollback` error was raised by a persistence method (e.g. in an `after_save` callback), this logic would potentially discard the original state of the record from before the transaction, preventing it from being restored later when the transaction was rolled back.
* | | Pass the error instance as the second parameter of block executed by ↵yuuji.yaginuma2018-05-124-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `discard_on` I'm not sure what originally wanted to pass to the argument. However, as long as see the document added along with the commit, it seems just to be mistaken that trying to pass the error instance. https://github.com/rails/rails/pull/30622/files#diff-59beb0189c8c6bc862edf7fdb84ff5a7R64 Fixes #32853
* | | Merge pull request #32843 from ttanimichi/remove_unused_remove_fileYuji Yaginuma2018-05-121-4/+0
|\ \ \ | | | | | | | | Remove unused `remove_file` method
| * | | Remove unused `remove_file` methodTsukuru Tanimichi2018-05-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | In #32780, We have supported the `--skip-sprockets` option in the `app:update` task. When `options[:api]` is truthy, `option[:skip_sprockets]` is also truthy. So we can remove this `remove_file` method. https://github.com/rails/rails/blob/42b9e7e50c084e119a679cf155b70b5efc4d36ff/railties/lib/rails/generators/rails/app/app_generator.rb#L281-L283
* | | | Merge pull request #32874 from tylerhunt/remove_render_text_docsEileen M. Uchitelle2018-05-111-1/+0
|\ \ \ \ | | | | | | | | | | Remove reference to old `:text` rendering option
| * | | | Remove reference to old `:text` rendering optionTyler Hunt2018-05-111-1/+0
|/ / / / | | | | | | | | | | | | [ci skip]
* | | | `becomes` should clear the mutation tracker which is created in ↵Ryuta Kamizono2018-05-114-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `after_initialize` `becomes` creates new object and copies attributes from the receiver. If new object has mutation tracker which is created in `after_initialize`, it should be cleared since it is for discarded attributes. But if the receiver doesn't have mutation tracker yet, it will not be cleared properly. It should be cleared regardless of whether the receiver has mutation tracker or not. Fixes #32867.
* | | | Merge pull request #32849 from anthonycrumley/oxford-commasMatthew Draper2018-05-1134-115/+115
|\ \ \ \ | | | | | | | | | | Added a lot of Oxford commas
| * | | | Added a lot of Oxford commasAnthony Crumley2018-05-1034-115/+115
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | [ci skip] A regular expression was used to find a lot of missing Oxford commas and add them. The regular expression was as follows. ", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
* | | | Merge pull request #32859 from ↵George Claghorn2018-05-091-1/+1
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | assain/fix-typo-activesupport-instrumentation-guide Fix Typo In ActiveSupport Instrumentation Guide
| * | | [ci skip] fix typo in active_support_instrumentation.md guideAssain2018-05-101-1/+1
|/ / /
* | | Merge pull request #32835 from trezona-lecomte/ar_dirty_doc_fixClaudio B2018-05-081-20/+58
|\ \ \ | | | | | | | | Fix ActiveRecord::AttributeMethods::Dirty documentation
| * | | Fix ActiveRecord::AttributeMethods::Dirty documentation [ci skip]Kieran Trezona-le Comte2018-05-071-20/+58
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the documentation for the newly introduced (in 5.1) AR::Dirty methods was misleading, as it stated the the new methods were aliases for the old methods. This was false, and caused confusion when the differences in their implementation became apparent. This change attempts to describe the behaviour of these methods more accurately, also noting when they are likely to be useful (i.e. before or after saving a record). This change also makes minor updates to consistently format the documentation of this API, in accordance with the API Documentation Guidelines.
* | | Merge pull request #32833 from ryandav/activestorage_blob_set_content_typeGeorge Claghorn2018-05-085-9/+49
|\ \ \ | |_|/ |/| | Add option to ActiveStorage::Blob to set extract_content_type_from_io
| * | Add option to ActiveStorage::Blob to set extract_content_type_from_ioRyan Davidson2018-05-085-9/+49
| | | | | | | | | | | | | | | | | | | | | This adds a boolean argument called identify to ActiveStorage::Blob methods #create_after_upload, #build_after_upload and #upload. It allows a user to bypass the automatic content_type inference from the io.
* | | Fix named route parameter example [ci skip]yuuji.yaginuma2018-05-081-5/+5
| | | | | | | | | | | | The prefix of `new` and `edit` generated by `resources` is singular.
* | | Merge pull request #32842 from tjschuck/remove_extra_requiresRyuta Kamizono2018-05-081-2/+0
|\ \ \ | | | | | | | | Remove leftover requires