Jon Leighton
2120da7f73
ActiveRecord::Relation#primary_key should return a string, just like ActiveRecord::Base.primary_key does.
2011-01-03 16:24:32 -08:00
Aaron Patterson
23b03baba6
use the sql literal factory method
2010-12-24 16:01:07 -07:00
Aaron Patterson
0fbf829b1e
stop the recursive insanity
2010-12-24 15:59:02 -07:00
Aaron Patterson
34d79fad85
setting the primary key on the update manager
2010-12-24 15:59:02 -07:00
Raimonds Simanovskis
2b795050de
fixed retrieval of primary key value in Ralation#insert method
...
previously primary key value was always assigned nil which caused Oracle enhanced adapter failing tests
2010-12-23 23:22:00 +08:00
Aaron Patterson
63480d234d
stop delegating inserts to ARel, use the INSERT SQL ourselves
2010-12-16 01:49:29 +05:30
Aaron Patterson
b0fc912f1b
avoid deprecate api
2010-12-02 15:50:34 -08:00
Aaron Patterson
ead0c6eed3
removing more calls to deprecated methods
2010-12-02 15:07:00 -08:00
Aaron Patterson
39f5fc06cb
just call join_sql against the manager object
2010-11-30 16:42:21 -08:00
Aaron Patterson
fe522f79c7
we already know it is already an array, so we do not need to make really really sure it is an array
2010-11-30 15:53:04 -08:00
Aaron Patterson
ae6033331f
shorten up scope_for_create
2010-11-30 15:48:15 -08:00
Aaron Patterson
dccf624b64
Ruby 1.8, how does it work?
2010-11-30 15:20:27 -08:00
Aaron Patterson
c856e25b32
removing arel 1.0 compatibility
2010-11-30 14:56:53 -08:00
Aaron Patterson
6c32290bac
testing Relation#table_name
2010-11-30 14:29:35 -08:00
Aaron Patterson
b6848b6491
cleaning up where_values_hash
2010-11-30 12:05:02 -08:00
Aaron Patterson
296467fcc4
only returning where values for the corresponding relation, also filtering where value hash based on table name [ #5234 state:resolved] [ #5184 state:resolved]
2010-10-30 13:25:49 -07:00
Aaron Patterson
cc468d3ec8
exec returns an AR::Result
2010-10-26 13:44:07 -07:00
Aaron Patterson
6ceffb8178
adding bind_values to relations
2010-10-26 13:44:07 -07:00
Xavier Noria
21ff8849bb
in regexps, the dot in a character class is not a metacharacter
2010-10-15 16:31:00 +02:00
Aaron Patterson
c2cad2d97e
where_values_hash always returns a hash
2010-09-28 15:56:08 -07:00
Marcelo Giorgi
cdfd013dd7
Set attributes properly for model built from association with conditions [ #5562 state:resolved]
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-09-28 15:22:50 -03:00
Aaron Patterson
133742d185
@klass also uses DynamicFinderMatch, so no need for it on the relation
2010-09-27 16:51:12 -07:00
Jakub Suder
2524cf404c
fixed some issues with JSON encoding
...
- as_json in ActiveModel should return a hash
and handle :only/:except/:methods options
- Array and Hash should call as_json on their elements
- json methods should not modify options argument
[#5374 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-09-07 11:33:10 -07:00
Pratik Naik
3bd3e992ff
Improved indentation
2010-09-06 11:54:02 +01:00
Aaron Patterson
ee9e1570be
we should mark strings as SQL Literal values
2010-08-23 13:30:12 -07:00
Neeraj Singh
2e45542942
While creating a new record using has_many create method default scope of child should be respected.
...
author.posts.create should take into account default_scope
defined on post.
[#3939 : state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-19 14:52:15 -03:00
Santiago Pastorino
b451de0d6d
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 04:12:33 -03:00
Prem Sichanugrist
a7eb8d97a4
Removing most of the symbol to proc usage in Active Record
...
This will hopefully make Active Record run a bit more faster.
2010-08-13 16:24:49 -07:00
Aaron Patterson
12b3eca420
do not rely on arel class structure
2010-08-06 11:31:05 -07:00
Neeraj Singh
b8d9d9ce0a
updating documentation to ensure line does not exceed 100 columns
2010-08-02 11:09:31 -04:00
Aaron Patterson
d1c53a9ad2
reducing function calls and using faster methods for testing
2010-07-30 13:38:09 -07:00
Xavier Noria
755af49755
edit pass to apply API guideline wrt the use of "# =>" in example code
2010-07-30 02:30:04 +02:00
Aaron Patterson
e1df4b9568
adding a reader for loaded, initializing @loaded to false
2010-07-20 09:15:09 -07:00
Mislav Marohnić
571cb1ddc6
enable AS::JSON.encode to encode AR::Relation by providing as_json method
...
[#5073 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-13 08:09:28 +02:00
Mislav Marohnić
00f1cd71a9
fix ActiveRecord destroy_all so it returns destroyed records
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-07-08 11:35:17 -07:00
José Valim
417125e795
Tidy up deprecation message for with_exclusive_scope.
2010-06-29 17:42:20 +02:00
José Valim
bd1666ad1d
Add scoping and unscoped as the syntax to replace the old with_scope and with_exclusive_scope. A few examples:
...
* with_scope now should be scoping:
Before:
Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
After:
Comment.where(:post_id => 1).scoping do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
* with_exclusive_scope now should be unscoped:
class Post < ActiveRecord::Base
default_scope :published => true
end
Post.all #=> SELECT * FROM posts WHERE published = true
Before:
Post.with_exclusive_scope do
Post.all #=> SELECT * FROM posts
end
After:
Post.unscoped do
Post.all #=> SELECT * FROM posts
end
Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values:
Post.unscoped.all #=> SELECT * FROM posts
2010-06-29 17:18:55 +02:00
Santiago Pastorino
47134a04bb
blocks removed from all the ActiveRelation query_methods, extend method added instead
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-26 01:35:23 +02:00
Neeraj Singh
0bf3baa6b3
adding fix for to_xml for ActiveRecord relation object
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 18:00:32 +02:00
Neeraj Singh
eb04408a20
ActiveRecord's relation object should respond to to_json and to_yaml
...
[#4547 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 18:00:25 +02:00
Rizwan Reza
2b7f08428c
Adds basic description and title.
2010-06-16 22:15:04 +04:30
Evgeniy Dolzhenko
ccf9577aee
Fix a bunch of minor spelling mistakes
2010-06-11 14:15:34 +04:00
Raimonds Simanovskis
c51fa6bdfc
ignore raw_sql_ table alias that is used by Oracle adapter
2010-06-04 22:44:04 +03:00
Raimonds Simanovskis
a83e6b1b6a
downcase table names in aliased_table_name_for and references_eager_loaded_tables? methods (as Oracle quoted table names are in uppercase)
2010-06-04 22:44:03 +03:00
Pratik Naik
13eb2c87e6
Make Relation#inspect less noisy
2010-04-02 18:57:46 +01:00
Pratik Naik
cfa283201e
Goodbye ActiveRecord::NamedScope::Scope
2010-04-02 18:57:46 +01:00
Pratik Naik
83ebe6224f
Oops :extends is not a MULTI_VALUE_METHOD
2010-04-02 17:39:47 +01:00
Pratik Naik
b77dd218ce
Add Relation extensions
2010-04-02 17:38:02 +01:00
Xavier Noria
76f024ac8d
adds missing requires for Object#blank? and Object#present?
2010-03-28 14:15:02 +02:00
Emilio Tagua
d289e15af9
From and lock should be defined to be consistent with other ivars. Limit and offset are always defined, no need to test that.
...
[#4253 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-03-22 11:48:39 -07:00