Commit Graph

49650 Commits

Author SHA1 Message Date
Andrew White
ed5e4f8f35 Merge pull request #18749 from JuanitoFatas/doc/fix-type-in-deprecation
Fix a typo in deprecation warning. #process takes method instead of http_method.
2015-01-31 07:36:14 -08:00
Xavier Noria
8d15e072be fix kindlerb version [ci skip]
This means we know generation works with this version, it does not
mean it does not work with the last releases (should be tested).
2015-01-31 15:03:58 +01:00
Juanito Fatas
2e62d53c2f Fix a typo in deprecation warning. #process takes method instead of http_method. 2015-01-31 20:58:08 +08:00
Abdelkader Boudih
0ddf2eb9ac Merge pull request #18748 from JuanitoFatas/doc/process-format
[ci skip] Document format parameter of process method in AC test_case.
2015-01-31 12:55:35 +00:00
Juanito Fatas
8cd115488c [ci skip] Document format parameter of process method in AC test_case. 2015-01-31 20:52:17 +08:00
Yves Senn
afe402dac7 unify CHANGELOG format. [ci skip] 2015-01-31 11:54:00 +01:00
Godfrey Chan
33030ea7cb Fixed a few things from ee9e4c3
Mostly cosmetics, except that `isolate_namespace` should be applied to the last
module in the chain.
2015-01-30 15:42:51 -08:00
Godfrey Chan
3bfdad91de Merge pull request #13601 from robinboening/allow_dashes_in_gem_names
Allow hyphenated names for `rails plugin new` generator
2015-01-30 15:42:10 -08:00
Sean Griffin
31085a5cd4 Allow keyword arguments to work with ActiveJob
Unfortunately, the HashWithIndifferent access approach is insufficient
for our needs. It's perfectly reasonable to want to use keyword
arguments with Active Job, which we will see as a symbol keyed hash. For
Ruby to convert this back to keyword arguments, it must deserialize to a
symbol keyed hash.

There are two primary changes to the serialization behavior. We first
treat a HWIA separately, and mark it as such so we can convert it back
into a HWIA during deserialization.

For normal hashes, we keep a list of all symbol keys, and convert them
back to symbol keys after deserialization.

Fixes #18741.
2015-01-30 13:43:39 -07:00
Sean Griffin
b93b39eff6 Remove most type related predicates from Column
Remaining are `limit`, `precision`, `scale`, and `type` (the symbol
version). These will remain on the column, since they mirror the options
to the `column` method in the schema definition DSL
2015-01-30 11:42:54 -07:00
Sean Griffin
155b1b7fe3 Remove most uses of Column#cast_type
The goal is to remove the type object from the column, and remove
columns from the type casting process entirely. The primary motivation
for this is clarity. The connection adapter does not have sufficient
type information, since the type we want to work with might have been
overriden at the class level. By taking this object from the column,
it is easy to mistakenly think that the column object which exists on
the connection adapter is sufficient. It isn't.

A concrete example of this is `serialize`. In 4.2 and earlier, `where`
worked in a very inconsistent and confusing manner. If you passed a
single value to `where`, it would serialize it before querying, and do
the right thing. However, passing it as part of an array, hash, or range
would cause it to not work. This is because it would stop using prepared
statements, so the type casting would come from arel. Arel would have no
choice but to get the column from the connection adapter, which would
treat it as any other string column, and query for the wrong value.

There are a handful of cases where using the column object to find the
cast type is appropriate. These are cases where there is not actually a
class involved, such as the migration DSL, or fixtures. For all other
cases, the API should be designed as such that the type is provided
before we get to the connection adapter. (For an example of this, see
the work done to decorate the arel table object with a type caster, or
the introduction of `QueryAttribute` to `Relation`).

There are times that it is appropriate to use information from the
column to change behavior in the connection adapter. These cases are
when the primitive used to represent that type before it goes to the
database does not sufficiently express what needs to happen. An example
of this that affects every adapter is binary vs varchar, where the
primitive used for both is a string. In this case it is appropriate to
look at the column object to determine which quoting method to use, as
this is something schema dependent.

An example of something which would not be appropriate is to look at the
type and see that it is a datetime, and performing string parsing when
given a string instead of a date.  This is the type of logic that should
live entirely on the type. The value which comes out of the type should
be a sufficiently generic primitive that the adapter can be expected to
know how to work with it.

The one place that is still using the column for type information which
should not be necessary is the connection adapter type caster which is
sometimes given to the arel table when we can't find the associated
table. This will hopefully go away in the near future.
2015-01-30 10:38:44 -07:00
Sean Griffin
dedb946bfb Fix a state leak in autosave_association_test
The test added in 85465ed3e6c582d25f0c8fafe21f7a2c182c2f67 was passing
when the file was run on its own, but failing when the entire suite was
run since this test modifies the class and doesn't clean up.
2015-01-30 09:34:40 -07:00
Robin Böning
ee9e4c340e Allow hyphenated names for rails plugin new generator.
It was not possible to create a new gem with a hyphenated name via the `rails plugin new` generator.

The naming guide of rubygems clearly says dashes should be used for gems that extend other gems. http://guides.rubygems.org/name-your-gem/
2015-01-30 16:40:45 +01:00
Sean Griffin
85465ed3e6 Always perform validations on nested attribute associations
Collection associations would have already been validated, but singular
associations were not.

Fixes #18735.
2015-01-30 07:27:20 -07:00
Yves Senn
5170c11c97 fix typo in _filter deprecation message. [ci skip] 2015-01-30 14:01:58 +01:00
Yves Senn
570ead9bed build fix II, adjust broken tests as a consequence of 670ac73126. 2015-01-30 13:52:18 +01:00
Yves Senn
f332ed0b9a build fix. 2015-01-30 13:35:35 +01:00
Yves Senn
670ac73126 scaffold controller_test template should use kwargs. refs #18323.
This prevents a flood of warnings when generating a new scaffold.
2015-01-30 12:31:44 +01:00
Yves Senn
1fa7861bc9 tests, use capture instead of custom redirect_stderr helper. 2015-01-30 12:04:57 +01:00
Yves Senn
4a0046164d Merge pull request #18736 from nonsensery/autoload-guide-grammar-fix
Fix grammar in Qualified Constants section [ci skip]
2015-01-30 08:32:31 +01:00
Ryuta Kamizono
add37bd645 Fix test_types_line_up when column type missing
a column type `xml` is missing in regexp pattarn. However,
`assert_equal 1, lengths.uniq.length` is success when `lengths` are all
`nil` because a column type is missing. a test will be failed by using
`compact` when a column type is missing.
2015-01-30 13:40:29 +09:00
Alex Johnson
dc6f5cb0dd Fix grammar in Qualified Constants section
New wording is based on the "cref" sentence earlier in the section.

[ci skip]
2015-01-29 16:46:44 -08:00
Rafael Mendonça França
455e663c66 Merge pull request #18734 from andreynering/docs-dumping
Improvements about schema dumping [ci skip]
2015-01-29 20:53:55 -02:00
Andrey Nering
3f11bc00d7 Improvements about schema dumping [ci skip] 2015-01-29 20:51:11 -02:00
Samuel Cochran
3f528e371c Migrate old flash behaviour 2015-01-30 09:47:03 +11:00
Rafael Mendonça França
15200ade6f Merge pull request #18477 from Alamoz/scaffold_css_template
Add a margin to body and padding to th, td in scaffold.css.
2015-01-29 19:58:26 -02:00
Adrien Lamothe
2f98e8915b Add a margin to body and padding to th, td.
Add space to new css defs.
2015-01-29 13:52:43 -08:00
Rafael Mendonça França
f29cb2010d Merge pull request #18732 from BMorearty/document-bundle-update
Doc: run bundle update after cloning Rails.
2015-01-29 19:45:29 -02:00
Brian Morearty
552e9e2299 Doc: run bundle update after cloning Rails. 2015-01-29 13:34:44 -08:00
Rafael Mendonça França
50318f5d7e Remove duplicated tests 2015-01-29 19:25:57 -02:00
Rafael Mendonça França
4816449898 Merge pull request #18705 from mrgilman/skip-test
Update option to skip test in generators
2015-01-29 19:04:47 -02:00
Sean Griffin
38dd7939e6 Post.all.or(anything) == Post.all 2015-01-29 13:57:47 -07:00
Melanie Gilman
ec0f8ff23b Change option description and update test names 2015-01-29 15:44:26 -05:00
Rafael Mendonça França
6296c09e5b Merge pull request #18722 from bogdan/group-by-key-word
Fixed AR::Relation#group method when argument is a SQL reserved keyword
2015-01-29 14:40:21 -02:00
Bogdan Gusiev
e94330fe40 Fixed AR::Relation#group method when argument is a SQL reserved keyword 2015-01-29 17:27:02 +02:00
Rafael Mendonça França
bb6fe7e73a Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00
Rafael Mendonça França
7814f901e1 Use fixed fonts only in the name of the parameter 2015-01-29 12:19:21 -02:00
Rafael Mendonça França
0eb3ba0e65 Improve CHANGELOG 2015-01-29 11:52:10 -02:00
Rafael Mendonça França
a35ec0c022 Merge pull request #18323 from kirs/controller-test-kwargs
Use kwargs in ActionController::TestCase and ActionDispatch::Integration HTTP methods
2015-01-29 11:51:32 -02:00
Kir Shatrov
baf14ae513 Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration
Non-kwargs requests are deprecated now.
Guides are updated as well.

`post url, nil, nil, { a: 'b' }` doesn't make sense.
`post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
2015-01-29 14:44:46 +02:00
Samuel Cochran
f7adb34999 Discard from flash before persisting in session 2015-01-29 23:18:55 +11:00
Samuel Cochran
3a102d0528 Fix flash remaining after last flash deleted
Inside a controller functional test after the last flash is deleted it
still persists the flash because to_session_value is nil. We should
delete it from the session when the serialized version is nil, same as
the flash middleware.
2015-01-29 23:00:44 +11:00
Andrew White
069b72aaf0 Merge pull request #18627 from tekin/dont-blat-default-format
Preserve default format when generating URLs
2015-01-29 11:22:26 +00:00
Yves Senn
de3d615183 Merge pull request #18719 from 5t111111/add-fix-for-loading-fixtures-in-engine-tests
Add fix for loading fixtures in engine tests (additional fix for #4971)

Conflicts:
	railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb
2015-01-29 09:54:50 +01:00
Yves Senn
d88f4bc1c1 reassign file_fixture_path in plugins test_helper.rb. refs #18658. 2015-01-29 09:34:56 +01:00
Xavier Noria
80c30e4b8f let dependencies use Module#const_defined?
Module#const_defined? accepts constant paths in modern Ruby, we no longer
need our qualified_* extensions.

References #17845.
2015-01-28 21:47:15 -08:00
WAKASUGI 5T111111
0176aef1eb Add fix for loading fixtures in engine tests 2015-01-29 12:15:42 +09:00
Sean Griffin
74c2961bd8 Don't error when grouped calculations return 0 records
Fixes #18717
2015-01-28 16:01:12 -07:00
Sean Griffin
9e42cf019f Merge Pull Request #16052 Added #or to ActiveRecord::Relation 2015-01-28 15:21:23 -07:00
Sean Griffin
96ac14a385 Always convert strings to UTF-8, regardless of column type in SQLite
All columns which would map to a string primitive need this behavior.
Binary has it's own marker type, so it won't go through this conversion.
String and text, which need this, will.

Fixes #18585.
2015-01-28 15:19:13 -07:00