aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge pull request #22008 from rails/revert-19898-common-secretsSean Griffin2015-10-201-16/+0
|\ \ | | | | | | Revert " Added an example to show how common secrets can be shared ac…
| * | Revert " Added an example to show how common secrets can be shared across ↵Sean Griffin2015-10-201-16/+0
|/ / | | | | | | multiple environments in secrets.yml"
* | Merge pull request #19851 from repinel/numericality-validation2Sean Griffin2015-10-202-13/+47
|\ \ | | | | | | Use the post-type-cast version of the attribute to validate numericality
| * | Conditionally convert the raw_value received by the numeric validator.Roque Pinel2015-07-112-13/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the issue where you may be comparing (using a numeric validator such as `greater_than`) numbers of a specific Numeric type such as `BigDecimal`. Previous behavior took the numeric value to be validated and unconditionally converted to Float. For example, due to floating point precision, this can cause issues when comparing a Float to a BigDecimal. Consider the following: ``` validates :sub_total, numericality: { greater_than: BigDecimal('97.18') } ``` If the `:sub_total` value BigDecimal.new('97.18') was validated against the above, the following would be valid since `:sub_total` is converted to a Float regardless of its original type. The result therefore becomes Kernel.Float(97.18) > BigDecimal.new('97.18') The above illustrated behavior is corrected with this patch by conditionally converting the value to validate to float. Use the post-type-cast version of the attribute to validate numericality [Roque Pinel & Trevor Wistaff]
* | | Merge pull request #19889 from cedrics/long-uri-encoded-keysSean Griffin2015-10-202-3/+9
|\ \ \ | | | | | | | | FileStore: Long cache keys may result in too long paths due to encoding
| * | | when checking for too long cache keys used the uri encoded fname Cedric Sohrauer2015-04-242-3/+9
| | | |
* | | | Merge pull request #19898 from prathamesh-sonpatki/common-secretsSean Griffin2015-10-201-0/+16
|\ \ \ \ | | | | | | | | | | Added an example to show how common secrets can be shared across multiple environments in secrets.yml [ci skip]
| * | | | Added example of sharing secrets in multiple environments in secrets.ymlPrathamesh Sonpatki2015-05-261-0/+16
| | | | |
* | | | | Merge pull request #19938 from vngrs/join_dependency_instantiate_bugSean Griffin2015-10-206-6/+29
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix for activerecord join dependency instantiate bug
| * | | | | Fix merge conflicts for #19938Sean Griffin2015-10-206-6/+29
|/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a separate commit, as it is not just a changelog conflict. Want to point out the changes in the code
| * | | | | Fix for activerecord join dependency instantiate bugMehmet Emin İNAÇ2015-05-046-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | use only object_id instead parent class and parent id test cases assert_equal use table name in references fix minor problems
* | | | | | Merge pull request #19992 from greysteil/handle-invalid-utf8-in-html-escapeSean Griffin2015-10-203-4/+19
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Handle invalid UTF-8 strings when HTML escaping
| * | | | | | Handle invalid UTF-8 strings when HTML escapingGrey Baker2015-06-083-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8 strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`. Prevents user-entered input passed from a querystring into a form field from causing invalid byte sequence errors.
* | | | | | | Fix minor typo from #20038Sean Griffin2015-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We use one period after spaces, not two.
* | | | | | | Merge pull request #20482 from nashby/collection-label-forSean Griffin2015-10-200-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Collection input propagates input's id to the label's for attribute.
* | | | | | | Collection check boxes propagates input's id to the label's for attribute.Vasiliy Ermolovich2015-10-203-0/+18
| | | | | | |
* | | | | | | Merge pull request #20038 from imanel/numeric_prependSean Griffin2015-10-203-44/+22
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Use Module.prepend instead of alias_method and unify behavior of all Numeric extensions
| * | | | | | | Unify behavior of all Numeric extensions and use Module.prepend instead of ↵Bernard Potocki2015-05-283-44/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alias_method
* | | | | | | | Merge pull request #20653 from repinel/allow-arel-select-countSean Griffin2015-10-202-1/+55
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Allow select using Arel and perform a count
| * | | | | | | | Allow select with Arel and count as well as calculations with ArelRoque Pinel2015-06-302-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows a query like `User.select(:name).count` to be written using Arel as `User.select(User.arel_table[:name]).count`. It exposes the calculations API to accept Arel nodes: `User.count(User.arel_table[:name])`, `User.sum(User.arel_table[:id])`, `Account.average(Account.arel_table[:credit_limit])`, `Account.maximum(Account.arel_table[:credit_limit])` and `Account.minimum(Account.arel_table[:credit_limit])`.
* | | | | | | | | Merge pull request #21762 from jmccartie/jm/uuidSean Griffin2015-10-204-1/+26
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set active_record config for always creating uuids in generators
| * | | | | | | | | Set active_record config for always creating uuids in generatorsJon McCartie2015-10-204-1/+26
| | | | | | | | | |
* | | | | | | | | | Merge pull request #20715 from simsalabim/feature/parse-rss-atom-as-xmlSean Griffin2015-10-203-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parse RSS/ATOM responses as XML, not HTML
* | | | | | | | | | Merge pull request #20737 from gouravtiwari/multibyte_chars_slice_fixSean Griffin2015-10-203-2/+23
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed multibyte-chars slice! behavior to return nil for out-of-bound parameters
| * | | | | | | | | | Update #20737 to address feedbackSean Griffin2015-10-203-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that this pull request affects a mutable value, we need to test for and document the affects on the receiver in this case. Additionally, this pull request was missing a CHANGELOG entry.
| * | | | | | | | | | Fixed slice! behavior: return nil for out-of-bound parametersGourav Tiwari2015-10-202-1/+6
|/ / / / / / / / / /
* | | | | | | | | | Merge pull request #20768 from ↵Sean Griffin2015-10-201-1/+3
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vrybas/guides-clarify-belongs-to-required-by-default [Rails Guides] clarify `belongs_to_required_by_default` option [ci skip]
| * | | | | | | | | | Update #20768 to address feedbackSean Griffin2015-10-201-3/+3
| | | | | | | | | | |
| * | | | | | | | | | [Rails Guides] Clarify `belongs_to_required_by_default` optionVladimir Rybas2015-10-201-1/+3
|/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original: * `config.active_record.belongs_to_required_by_default` is a boolean value and controls whether `belongs_to` association is required by default. Modified version: * `config.active_record.belongs_to_required_by_default` is a boolean value and controls whether validation error is triggered by default if `belongs_to` association is not present or not valid.
* | | | | | | | | | Merge pull request #20795 from benjiwheeler/validation_guide_ret_valSean Griffin2015-10-201-7/+15
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | activerecord guide: clarified roles of valid method and errors object [ci skip]
| * | | | | | | | | | activerecord guide: clarified roles of valid method and errors object [ci skip]Ben Wheeler2015-07-081-7/+15
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #20872 from maxjacobson/more-humane-roundingSean Griffin2015-10-203-2/+11
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Round some numbers more humanely
| * | | | | | | | | | | Update the changelog for #20872 to be a bit less confusingSean Griffin2015-10-201-2/+2
| | | | | | | | | | | |
| * | | | | | | | | | | Round some numbers more humanelyMax Jacobson2015-07-263-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #20869
* | | | | | | | | | | | Merge pull request #20934 from maurogeorge/migration-transformations-docSean Griffin2015-10-201-15/+51
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missed available transformations to Migration Doc [ci skip]
| * | | | | | | | | | | | Add missed Available transformations to migration DocMauro George2015-07-221-15/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | | | | | | | Merge pull request #20957 from akihiro17/find-by-issueSean Griffin2015-10-203-1/+13
|\ \ \ \ \ \ \ \ \ \ \ \ \ | |_|_|_|/ / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | Fix find_by with association subquery issue
| * | | | | | | | | | | | Don't cache arguments in #find_by if they are an ActiveRecord::Relationakihiro172015-10-063-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this commit, find_by doesn't cache arguments so that find_by with association subquery works correctly. Fixes #20817
* | | | | | | | | | | | | Merge pull request #21302 from theunraveler/delegate_reserved_argument_namesSean Griffin2015-10-202-5/+21
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport: Fixing issue when delegating to methods named "block", "args", or "arg"
| * | | | | | | | | | | | | Fixing issue when delegating to methods named "block", "args", or "arg"Jake Bell2015-08-192-5/+21
| | | | | | | | | | | | | |
* | | | | | | | | | | | | | Fix test failures caused by d99db6b8b3e4Sean Griffin2015-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I messed up the merge conflict, and accidentally removed a schema query that needed to be ignored.
* | | | | | | | | | | | | | Merge pull request #21756 from soutaro/qualify-column-in-calculationSean Griffin2015-10-203-1/+27
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qualify column names in calculation
| * | | | | | | | | | | | | | Qualify column names in calculationSoutaro Matsumoto2015-10-203-1/+27
|/ / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Column names inserted via `group` have to be qualified with table name.
* | | | | | | | | | | | | | Merge pull request #18856 from al2o3cr/issue_17897Sean Griffin2015-10-202-3/+11
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Match table names exactly on MySQL
| * | | | | | | | | | | | | | Fix merge conflicts for #18856Sean Griffin2015-10-202-3/+11
|/| | | | | | | | | | | | | |
| * | | | | | | | | | | | | | Match table names exactly on MySQLMatt Jones2015-02-084-18/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `SHOW TABLES LIKE` command accepts metacharacters `%` and `_` in potentially unexpected ways. This can be avoided by querying `information_schema.tables` directly. Fixes #17897
* | | | | | | | | | | | | | | Don't add classes to the top level namespaceSean Griffin2015-10-201-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've been writing too much Rust. My mind is still in the mode of things being auto-namespaced based on the file...
* | | | | | | | | | | | | | | Merge pull request #21883 from tarzan/cache-key-too-preciseSean Griffin2015-10-206-8/+43
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix precision on cache_key
| * | | | | | | | | | | | | | | fixes #21815Maarten Jacobs2015-10-166-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default timestamp used for AR is `updated_at` in nanoseconds! (:nsec) This causes issues on any machine that runs an OS that supports nanoseconds timestamps, i.e. not-OS X, where the cache_key of the record persisted in the database (milliseconds precision) is out-of-sync with the cache_key in the ruby VM. This commit adds: A test that shows the issue, it can be found in the separate file `cache_key_test.rb`, because - model couldn't be defined inline - transactional testing needed to be turned off to get it to pass the MySQL tests This seemed cleaner than putting it in an existing testcase file. It adds :usec as a dateformat that calculates datetime in microseconds It sets precision of cache_key to :usec instead of :nsec, as no db supports nsec precision on timestamps
* | | | | | | | | | | | | | | | Do not cache prepared statements that are unlikely to have cache hitsSean Griffin2015-10-2012-20/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, Rails makes no differentiation between whether a query uses bind parameters, and whether or not we cache that query as a prepared statement. This leads to the cache populating extremely fast in some cases, with the statements never being reused. In particular, the two problematic cases are `where(foo: [1, 2, 3])` and `where("foo = ?", 1)`. In both cases we'll end up quoting the values rather than using a bind param, causing a cache entry for every value ever used in that query. It was noted that we can probably eventually change `where("foo = ?", 1)` to use a bind param, which would resolve that case. Additionally, on PG we can change our generated query to be `WHERE foo = ANY($1)`, and pass an array for the bind param. I hope to accomplish both in the future. For SQLite and MySQL, we still end up preparing the statements anyway, we just don't cache it. The statement will be cleaned up after it is executed. On postgres, we skip the prepare step entirely, as an API is provided to execute with bind params without preparing the statement. I'm not 100% happy on the way this ended up being structured. I was hoping to use a decorator on the visitor, rather than mixing a module into the object, but the way Arel has it's visitor pattern set up makes it very difficult to extend without inheritance. I'd like to remove the duplication from the various places that are extending it, but that'll require a larger restructuring of that initialization logic. I'm going to take another look at the structure of it soon. This changes the signature of one of the adapter's internals, and will require downstream changes from third party adapters. I'm not too worried about this, as worst case they can simply add the parameter and always ignore it, and just keep their previous behavior. Fixes #21992.