Commit Graph

8369 Commits

Author SHA1 Message Date
Yves Senn
849400c36d improve Active Record Store docs when using PG types. [ci skip]. 2013-11-09 21:05:28 +01:00
Yves Senn
3bec1603f9 type casted PG bytea values are represented as a Hash.
This is a follow up to: 97f0d9a0dd12e7ad634815eecfeff866f64aad92
This change is also related to: df0edafac9eb47cd971970a9e7b13a3eaddf214e
2013-11-09 20:55:01 +01:00
Rafael Mendonça França
df0edafac9 Document the bind return 2013-11-09 17:51:26 -02:00
Rafael Mendonça França
aba688ed5c Avoid shot circuit return.
This will make the conditional and to code clear
2013-11-09 17:51:25 -02:00
Rafael Mendonça França
bdb8bc6e8a Don't use Active Support where we don't need to 2013-11-09 16:40:00 -02:00
Carlos Antonio da Silva
2fd095507c Fix typo in AR store docs [ci skip] 2013-11-09 16:12:38 -02:00
Yves Senn
97f0d9a0dd log bind variables after they were type casted.
The log output used to be confusing in situation where type casting has
"unexpected" effects. For example when finding records with a `String`.

BEFORE:

irb(main):002:0> Event.find("im-no-integer")
D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- :   Event Load (4.5ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", "im-no-integer"]]

AFTER:

irb(main):002:0> Event.find("im-no-integer")
D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- :   Event Load (4.5ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", 0]]
2013-11-09 11:23:34 +01:00
Rafael Mendonça França
587f15d191 Merge pull request #12791 from jasonayre/ja/fix_autoload_error
add autoload :TransactionState to fix Marshal.load issues
2013-11-07 14:15:33 -08:00
Vijay Dev
216ec8d559 Merge branch 'master' of github.com:rails/docrails 2013-11-07 23:32:47 +05:30
Jason Ayre
83689bec77 add autoload :TransactionState to fix Marshal.load issues 2013-11-07 07:57:13 -07:00
Aaron Patterson
5584ddc43d Stop using method missing for singleton delegation.
This saved about 46 array allocations per request on an extremely simple
application.  The delegation happened in the notification subsystem
which is a hotspot, so this should result in even more savings with
larger apps.

Squashed commit of the following:

commit 41eef0d1479526f7de25fd4391d98e61c126d9f5
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date:   Wed Nov 6 16:32:31 2013 -0800

    speed up notifications

commit 586b4a18656f66fb2c518fb8e8fee66a016e8ae6
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date:   Wed Nov 6 16:31:05 2013 -0800

    speed up runtime registry methods

commit b67d074cb4314df9a88438f785868cef77e583d7
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date:   Wed Nov 6 16:28:12 2013 -0800

    change method name and make it public
2013-11-06 16:32:47 -08:00
Yves Senn
aeaf3a9d00 bring back constant to expose the enum mapping as HWIA. 2013-11-06 15:27:33 +01:00
Yves Senn
a5176def3d refine usage docs of store in combination with hstore and json.
refs #11561 #12700
2013-11-06 10:54:08 +01:00
Yves Senn
02b6757797 update the AR enum docs to match the actual behavior. [ci skip] 2013-11-06 10:49:22 +01:00
Yves Senn
44406d1e77 store enum mapping using Strings instead of Symbols.
This allows to assign both `String` and `Symbol` values to the enum
without having to call `to_sym`, which is a security problem.
2013-11-05 17:44:08 +01:00
Yves Senn
6c720d18a2 direct enum assignment rasies ArgumentError for unknown values. 2013-11-05 17:44:08 +01:00
Yves Senn
813c8c0751 define enum methods inside a Module to make them overwritable. 2013-11-05 16:45:34 +01:00
Rafael Mendonça França
5a011409a4 Merge pull request #12390 from kennyj/rename_to_association_methods
Renamed generated_feature_methods to generated_association_methods.

Conflicts:
	activerecord/lib/active_record/associations/builder/association.rb
	activerecord/lib/active_record/associations/builder/singular_association.rb
	activerecord/test/cases/base_test.rb
2013-11-05 13:35:26 -02:00
Aaron Patterson
026d055568 ask the fixture set for the sql statements 2013-11-04 16:39:34 -08:00
Aaron Patterson
9f8762f1d5 The enum value constant isn't used, so rm it for now. 2013-11-04 15:55:29 -08:00
Aaron Patterson
238ee10c41 stop doing the same calculation over and over 2013-11-04 15:51:09 -08:00
Carlos Antonio da Silva
6d540d135f Fix failures related to enum changes
Commit 6e4a810f51b9ed2468b92247ef5568cc9d6dbcc0 changed the implementation
from class_eval to define_method, but missed the access to the constant
versus the access to the constant name.
2013-11-04 13:40:16 -02:00
Carlos Antonio da Silva
d0d7555e87 Refactor logic to grab the max time of the list of timestamp names in #cache_key
Reuse the already existing logic used for grabbing this information from
the updated columns.
2013-11-04 13:14:07 -02:00
Carlos Antonio da Silva
92c6305954 Respect cache timestamp format when giving timestamps to #cache_key 2013-11-04 13:11:51 -02:00
Carlos Antonio da Silva
91d72fe652 ✂️ [ci skip] 2013-11-04 13:01:57 -02:00
Vitaly Tatarintsev
8264701355 Replace class_eval with define_method for enum
db41eb8a6e (commitcomment-4502683)
2013-11-04 16:42:22 +02:00
David Heinemeier Hansson
430b252d3d Revert "ActiveRecord::Base#<=> has been removed. Primary keys may not be in order," -- will be replaced with a check to ensure that the keys used for comparison are integers, and only fail if they are not.
This reverts commit 6256734e2d0bdd89f4b5d11da259d40afa0c95c7.

Conflicts:
	activerecord/CHANGELOG.md
2013-11-02 19:56:58 -07:00
David Heinemeier Hansson
661637e5b6 Delegate #rewhere to all on the class like all other relation methods 2013-11-02 19:45:03 -07:00
David Heinemeier Hansson
fe9773414a Move documentation around a bit 2013-11-02 18:32:08 -07:00
David Heinemeier Hansson
0342335473 Merge pull request #12747 from yury/explicit-enum-values
Explicit mapping for enum
2013-11-02 18:29:22 -07:00
Yury Korolev
7caa09c5e1 Explicit mapping for enum 2013-11-02 17:48:16 -07:00
David Heinemeier Hansson
f950b2699f Added ActiveRecord::QueryMethods#rewhere which will overwrite an existing, named where condition. 2013-11-02 17:36:45 -07:00
Rafael Mendonça França
4d7080f80c unscope now works on default_scope after 94924dc32baf78f13e289172534c2e71c9c8cade 2013-11-02 22:11:20 -02:00
David Heinemeier Hansson
e94e97ca79 Extend ActiveRecord::Base#cache_key to take an optional list of timestamp attributes of which the highest will be used. 2013-11-02 16:05:19 -07:00
Carlos Antonio da Silva
6963e8959f Fix to work on Ruby 1.9.3, example and changelog improvements 2013-11-02 18:08:37 -02:00
David Heinemeier Hansson
db41eb8a6e Added ActiveRecord::Base#enum for declaring enum attributes where the values map to integers in the database, but can be queried by name 2013-11-02 12:01:31 -07:00
Rafael Mendonça França
1918b12c04 Fix wrong behavior where associations with dependent: :destroy options
was using nullify strategy

This caused a regression in applications trying to upgrade.

Also if the user set the dependent option as destroy he expects to get
the records removed from the database.
2013-11-01 19:04:30 -02:00
Arun Agrawal
816126862e Warnings removed for ruby trunk
Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
2013-11-01 09:49:57 +01:00
Yves Senn
d0ea5c5b20 fix code typo in MysqlAdapter .Closes #12647. 2013-10-30 18:12:26 +01:00
Robin Dupret
1478ebf66c Hstore and JSON fields are not supported with store
The use of `store` on Hstore fields (for instance) is not needed
because serialization aimed to interact with Ruby objects and not
with provided field types
2013-10-30 17:08:20 +01:00
Jan Bernacki
510601ce8e short arrays in inspect 2013-10-30 08:47:54 +04:00
Yves Senn
cd3a8fecf1 Merge pull request #10664 from aderyabin/docpatch
Fix doc in Postgres database creation [ci skip]
2013-10-29 01:28:02 -07:00
Jeremy Kemper
6935075c8f Remove confusing generated-code commentary 2013-10-28 17:15:59 -07:00
Rafael Mendonça França
6fb056e3b6 Merge pull request #12578 from jeradphelps/configurable_schema_migrations_table_name
Configurable name for schema_migrations table

Conflicts:
	activerecord/CHANGELOG.md
2013-10-27 21:07:03 -02:00
Rafael Mendonça França
e17979e4f7 Merge pull request #12664 from jetthoughts/12242_includes_in_through_association
Skip `include_values` from through associations chains for building association scope
2013-10-27 13:05:19 -07:00
Paul Nikitochkin
6b71a1416c Skip include_values from through associations chains for building target scope
Fixes: #12242, #9517, #10240
2013-10-27 21:15:41 +02:00
David Heinemeier Hansson
6605231231 Add a note about ensuring the version is right for the adapter (since you might well have specified the right gem, but locked it to too low of a version) 2013-10-27 09:46:45 -07:00
Jerad Phelps
26638f0ac9 added schema_migrations_table_name to ActiveRecord::Base in order that the name of the schema migrations table can be configured.
consolidated test_schema_migrations_table_name tests

Added changelog entry

edited changelog

removed commented lines

removed reader

ensure the schema migrations table is reset at end of test

added entry to configuration guide

guides typo and changelog order
2013-10-27 08:50:35 -05:00
Chris Ledet
6f511943f8 Fixed typo with after_commit docs
Fixed syntax error on `after_commit` docs
2013-10-25 16:59:48 -04:00
Severin Schoepke
c3606afb2a cast json values on write to be consistent with reading from the db.
See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
2013-10-25 17:05:42 +02:00