| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ \ \ \
| |/ / /
|/| | | |
Array#in_groups: documentation updated [ci skip]
|
| | |/
| |/| |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
In #12203, the JSON core extensions were moved into the `core_ext`
folder. Unfortunately, there are some corresponding requires that
were left behind. The problem is partially addressed in #12710, this
commit fixes the rest.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
See [1] for why this is not a good idea.
As part of this refactor, circular reference protection in as_json has
been removed and the corresponding error class has been deprecated.
As discussed with @jeremy, circular reference error is considered
programmer errors and protecting against it is out of scope for
the encoder.
This is again based on the excellent work by @sergiocampama in #11728.
[1]: https://github.com/intridea/multi_json/pull/138#issuecomment-24468223
|
| |
| |
| |
| |
| |
| |
| | |
So strings can be humanized without being capitalized:
'employee_salary'.humanize # => "Employee salary"
'employee_salary'.humanize(capitalize: false) # => "employee salary"
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.
We also shouldn't be implementing `to_json` most of the time, and
these occurances are replaced with an equivilent `as_json`
implementation to avoid problems down the road.
See [1] for all the juicy details.
[1]: intridea/multi_json#138 (comment)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These methods now takes the same options as Hash#as_json, for example:
struct = Struct.new(:foo, :bar).new
struct.foo = "hello"
struct.bar = "world"
json = struct.as_json(only: [:foo]) # => {foo: "hello"}
This is extracted from PR #11728 from @sergiocampama, see also the
discussion in #11460.
|
| |
| |
| |
| | |
them to JavaScript functions like getTime().
|
| |
| |
| | |
Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
|
|\ \
| | |
| | | |
Add Rdoc document for Array#forty_two [ci skip]
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
Same as #12710 but for the time module this time. This time it should
fix the Active Model test suite in isolation avoiding a TypeError to
be raised about the superclass of the DateTime object.
|
| |
| |
| |
| |
| |
| |
| |
| | |
If we try to monkey-patch the class before requiring it, then a
"superclass mismatch" (TypeError) error is raised and the build can't
run correctly.
Fixes #12708
|
|\ \
| | |
| | | |
Eagerload active_support/json/encoding in active_support/core_ext/object/to_json
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
TL;DR The primary driver is to remove autoload surprise.
This is related to #12106. (The root cause for that ticket is that
json/add defines Regexp#to_json among others, but here I'll reproduce
the problem without json/add.)
Before:
>> require 'active_support/core_ext/to_json'
=> true
>> //.as_json
NoMethodError: undefined method `as_json' for //:Regexp
from (irb):3
from /Users/godfrey/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>'
>> //.to_json
=> "\"(?-mix:)\""
>> //.as_json
=> "(?-mix:)"
After:
>> require 'active_support/core_ext/to_json'
=> true
>> //.as_json
=> "(?-mix:)"
This is because ActiveSupport::JSON is autoloaded the first time
Object#to_json is called, which causes additional core extentions
(previously defined in active_support/json/encoding.rb) to be loaded.
When someone require 'active_support/core_ext', the expectation is
that it would add certain methods to the core classes NOW. The
previous behaviour causes additional methods to be loaded the first
time you call `to_json`, which could cause nasty surprises and other
unplesant side-effects.
This change moves all core extensions in to core_ext/json. AS::JSON is
still autoloaded on first #to_json call, but since it nolonger
include the core extensions, it should address the aforementioned bug.
*Requiring core_ext/object/to_json now causes a deprecation warnning*
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Due to changes from http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39628 current `singleton_class?` implementation fails.
Changed based on reference from http://bugs.ruby-lang.org/issues/7609
|
|\ \ \
| |/ /
|/| | |
Prevent server blow up when iterating over TimeWithZone Range
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Generalize backtrace check on DelegationError.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Different Ruby implementations present backtraces differently, as
it should be an information consumed by humans.
A better implementation should use data from the error, in this case
returned by NoMethodError#name.
Fixes issues with Rubinius, which presents backtraces differently from
MRI.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
#11831
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Conflicts:
actionview/README.rdoc
activerecord/lib/active_record/migration.rb
guides/source/development_dependencies_install.md
guides/source/getting_started.md
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.
Seems to be a code merge done by mistake.
|
| | | | | |
|
| |/ / /
|/| | |
| | | |
| | | | |
String#gsub(pattern, '')
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Jruby cannot unlink a tempfile unless it is closed first.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Similar implementations of #in_time_zone exists for Date, Time and DateTime so
method is extracted into its own module. Also some logic is extracted into
private method.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Methods: :past? and :future? are already defined identically
in date_and_time/calculations.rb which is included in Date.
Because DateTime is a subclass of Date, it can call them.
|
|\ \ \ \
| | | | |
| | | | | |
Added Time#middle_of_day method
|
| | | | |
| | | | |
| | | | |
| | | | | |
Added middle_of_day method to Date and DateTime
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Use a lambda to ensure that the generated string respects the offset of
the time value. Also add DateTime#to_s(:iso8601) and Date#to_s(:iso8601)
for completeness.
|
| |/ / /
|/| | |
| | | |
| | | | |
for easy Javascript date parsing
|
|\ \ \ \ |
|
| | | | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Minor refactor - Uses Enumerable#to_a instead of iterate and add to an array
|
| | | | |
| | | | |
| | | | |
| | | | | |
array
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
|
| |\ \ \ \ |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Array#to_s calls each element's inspect since ruby 1.9
|
| |/ / / / |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This fixes situations where nested NoMethodError exceptions are masked
by delegations. This would cause confusion especially where there was a
problem in the Rails booting process because of a delegation in the
routes reloading code.
Fixes #10559
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
If the DateTime core extensions were loaded before the Date core extensions
then you would get a superclass mismatch as DateTime hasn't been defined
yet so it gets set to Object by the acts_like core extension.
Fixes #11206
|