Commit Graph

48832 Commits

Author SHA1 Message Date
eileencodes
cc9b813a82 Pass connection rather than alias_tracker
After the refactorings we're only using the connection and not the alias
tracker anymore. This builds on commit 18019.

Reuse the already available `@connection` to reduce the surface area of
the alias tracker's API. We can then remove the `attr_reader` because
the connection is already available.
2015-01-02 17:15:31 -05:00
eileencodes
f6729309a0 Assign the #alias_name to each reflection
This makes the `#alias_name` more functional.
2015-01-02 17:15:31 -05:00
eileencodes
e9684d6c88 Clean up / refactor new reflection classes
Move `RuntimeReflection` and `PolymorphicReflect` into Reflection. This
allows the methods to inherit from `ThroughReflection` and DRY up the
methods by removing duplicates.
2015-01-02 17:15:31 -05:00
eileencodes
4d27d56c35 Refactor #get_chain iteration to a linked list
The linked list lets us use a loop in `#add_constraints` and completely
remove the need for indexing the iteration becasue we have access to the
next item in the chain.
2015-01-02 17:15:31 -05:00
eileencodes
17f6ca1e8a Refactor #get_chain to remove need for #construct_tables
By concatnating the `ReflectionProxy` with the `chain` we remove
the need for `#construct_tables` because the `chain` is now in the
correct order (order of the chain DOES matter).
2015-01-02 17:15:31 -05:00
eileencodes
5b0b3cce5c Move #alias_name to ReflectionProxy class
Putting the `#alias_name` into ReflectionProxy means we don't have to
cache the `#alias_name` globally anymore - it's not cached per query.
2015-01-02 17:15:30 -05:00
eileencodes
092171da30 Clean up assignments in #add_constraints
`is_first_chain`, `items` and `klass` are no longer beneficial and can
be called directly instead of via their assignments - because they are
each only used once.
2015-01-02 17:15:30 -05:00
eileencodes
076682692c Refactor construct_tables method
Move method structure into reflection classes for accessibly on each
reflection rather than by traversing the chain.
2015-01-02 17:15:30 -05:00
eileencodes
69d05ae3e5 Add RuntimeReflection for recursive access to chain
The `RuntimeReflection` class allows the reflection to be accessed at
runtime - then we always know which reflection we are accessing in the
chain. The `#get_chain` method then allows us to recursively access the
chain through the `RuntimeReflection`.
2015-01-02 17:15:30 -05:00
eileencodes
08acb4bccb Add PolymorphicReflection and constraints method
`#constraints` builds a flattened version of `scope_chain` to
allow it to be accessible without requiring an index when iterating
over the `scope_chain`
2015-01-02 17:15:30 -05:00
Rafael Mendonça França
9b366b95f9 Don't test invalid log encoding against PostgreSQL adapter
It already treats the message
2015-01-02 19:00:33 -03:00
Robin Dupret
4b04fc0528 A quick pass through NestedAttributes' doc [ci skip] 2015-01-02 22:05:52 +01:00
Zachary Scott
de1c1a6f7b Revert part of 996e646bd8cff3bcf2b13863439f48d3e744cdae [ci skip] 2015-01-02 12:19:52 -08:00
Robin Dupret
843fc99786 Follow up to #17973 [ci skip] 2015-01-02 20:26:39 +01:00
Rafael Mendonça França
c2d2a7d4cc Merge pull request #17822 from kamipo/refactor_visit_change_column_definition
Refactor `visit_ChangeColumnDefinition`
2015-01-02 16:21:55 -03:00
Rafael Mendonça França
3793b4063a Merge pull request #8547 from printercu/patch-1
fix for messages in invalid encoding from db-drivers

Conflicts:
	activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
	activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
2015-01-02 16:15:18 -03:00
Ryuta Kamizono
3c10043bc2 Refactor visit_ChangeColumnDefinition
`visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
2015-01-03 02:46:07 +09:00
Ryuta Kamizono
84859c45a7 Add default value for create_table_definition
In most cases, `create_table_definition` called by table_name (the first
argument) only.
2015-01-03 02:38:22 +09:00
Rafael Mendonça França
dbe7fe289c Merge pull request #17820 from fw42/restore_query_cache_on_rollback
Clear query cache on rollback
2015-01-02 14:36:23 -03:00
Rafael Mendonça França
ecdae459d2 Merge pull request #15309 from iantropov/issue_12698_build_through
Add setting of FK for throgh associations while building

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/has_many_through_associations_test.rb
2015-01-02 14:29:07 -03:00
Rafael Mendonça França
2d743b528c Merge pull request #17978 from kommen/fixed-pr-14903
Ensure append_info_to_payload is called even if an exception is raised.

Conflicts:
	actionpack/CHANGELOG.md
2015-01-02 14:16:15 -03:00
Rafael Mendonça França
873870df4c Merge pull request #17974 from killthekitten/fix-render-block
Make possible to use blocks with short version of render partial

Conflicts:
	actionview/CHANGELOG.md
2015-01-02 14:12:23 -03:00
Rafael Mendonça França
c455817804 Merge pull request #17973 from maurogeorge/file_field_hidden_field
Generate a hidden_tag when using a file_field
2015-01-02 13:57:33 -03:00
Rafael Mendonça França
8b3cd74b8a Remove thread variables backport
They are already present on Ruby 2.2
2015-01-02 13:50:11 -03:00
Rafael Mendonça França
a908e01ac0 Merge pull request #18228 from kamipo/correctly_dump_primary_key
Improve a dump of the primary key support.

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 13:37:26 -03:00
Rafael Mendonça França
78dab2a856 Remove support to activerecord-deprecated_finders 2015-01-02 12:06:24 -03:00
Rafael Mendonça França
e8615b99c6 Merge pull request #16749 from robin850/rbx-name-error
Rely on NameError#name instead of its error message
2015-01-02 11:22:03 -03:00
Rafael Mendonça França
acb1991910 Merge pull request #18067 from kamipo/format_datetime_string_according_to_precision
Format the datetime string according to the precision of the datetime field.

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 11:17:55 -03:00
Mauro George
00b26532f0 Add a hidden_field on the file_field
This will avoid a error be raised when the only input on the form is the
`file_field`.
2015-01-02 12:15:03 -02:00
Rafael Mendonça França
bed2bdb17c Merge pull request #15746 from amccloud/auto-inverse_of-in-module
Fixed automatic inverse_of for models nested in module

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 11:06:17 -03:00
Rafael Mendonça França
6442c90f09 Merge pull request #18298 from brainopia/integration_requests_without_setup
Integration requests should work in contexts without setup and teardown
2015-01-02 10:59:59 -03:00
brainopia
95333e1317 Integration requests should work in contexts without setup and teardown 2015-01-02 16:52:32 +03:00
Rafael Mendonça França
9598c9655f Merge pull request #11898 from prathamesh-sonpatki/patch-update
Changed ActiveRecord::Relation#update behavior so that it will work on Relation objects without giving id

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 10:48:48 -03:00
Rafael Mendonça França
a016f9b728 Merge pull request #18290 from lucascaton/guides_updates
Updating guides for Rails 5.0
2015-01-02 10:38:53 -03:00
Ryuta Kamizono
4157f5d172 Format the datetime string according to the precision of the datetime field.
Incompatible to rounding behavior between MySQL 5.6 and earlier.

In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:

http://bugs.mysql.com/bug.php?id=68760
2015-01-02 22:30:07 +09:00
Ryuta Kamizono
ae419af666 Allow precision option for MySQL datetimes. 2015-01-02 22:30:07 +09:00
Carlos Antonio da Silva
b63382ec06 Remove warnings
warning: ambiguous first argument; put parentheses or a space even after
    `/' operator'`
2015-01-02 10:29:57 -02:00
Carlos Antonio da Silva
120bf7444f Verify the helper name with plural as it is generated
Thanks @robin850.
2015-01-02 10:29:36 -02:00
Carlos Antonio da Silva
58009ace37 Add branch to gems pointing to github so that we can use local checkouts 2015-01-02 10:26:10 -02:00
Lucas Caton
dee4c2723a Including links to earlier releases guides (4.1.8 and 4.0.12) [ci skip] 2015-01-02 15:44:25 +10:00
Rafael Mendonça França
70c2777d1c Merge pull request #18080 from korbin/fix_reaping_frequency_configuration
Fix issue with reaping_frequency type.
2015-01-02 01:37:07 -03:00
Rafael Mendonça França
7c6861b0bc Do not check only for the Rails constant
This constant may be define for auxiliar gems like rails-html-sanitizer
and these methods call will fail.
2015-01-02 00:45:09 -03:00
Rafael Mendonça França
8a1c3476a6 Do not run integration tests for the test adapter 2015-01-02 00:09:10 -03:00
Rafael Mendonça França
ef877bbc93 Merge pull request #18288 from claudiob/add-skip-action-mailer
Add --skip-action-mailer (or -M) to rails generate
2015-01-01 23:52:57 -03:00
claudiob
b6f50b3fa8 Add --skip-action-mailer (or -M) to rails generate 2015-01-01 18:46:12 -08:00
Rafael Mendonça França
4ba0e2fc22 Fix scaffold generator with --helper=false option 2015-01-01 23:16:30 -03:00
Rafael Mendonça França
ac0a8eec62 Fix test description to match the test behaviour 2015-01-01 22:44:30 -03:00
Rafael Mendonça França
41d72ce372 Remove conversion code for old Rails cache entry
This code was there just to convert entries generated in Rails
4.0.0.beta1 applications to a supported format.

It is almost unlikely that any existent application have this cache
entry format in their caches at the point that Rails 5 will be released
so we don't need this code anymore.
2015-01-01 22:31:27 -03:00
Rafael Mendonça França
ddd0a22133 Check by @v before converting the entry on expired?
We should convert when @v is defined not @value.

The test was calling value first that already converts the entry so we
are not catching this bug.
2015-01-01 22:28:07 -03:00
Lucas Caton
8d2135881c Using Rails 5.0 in bug report templates [ci skip] 2015-01-02 09:06:11 +10:00