Jon Leighton
681ab53ba1
Get rid of set_association_target and association_loaded? as the parts of the code that need that can now just use association_proxy(:name).loaded?/target=
2011-01-11 13:45:08 -08:00
Jon Leighton
42b2e4f85b
We can use the association_proxy method directly in HasOneThroughAssociation now
2011-01-11 13:45:08 -08:00
Jon Leighton
3b797c8c86
DRY up the code which instantiates the association proxy
2011-01-11 13:45:08 -08:00
Jon Leighton
4754018272
find_target can be inherited
2011-01-11 13:45:07 -08:00
Jon Leighton
9086b02ba5
Document the recent changes to association assignment
2011-01-11 13:45:07 -08:00
Jon Leighton
6055bbedaa
Raise ActiveRecord::RecordNotSaved if an AssociationCollection fails to be replaced
2011-01-11 13:45:07 -08:00
Jon Leighton
1d6e218428
When assigning a has_one, if anything fails, the assignment should be rolled back entirely
2011-01-11 13:45:07 -08:00
Jon Leighton
4e19ec566c
In a number of places in the tests, we only need to turn off transactional fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :)
2011-01-11 13:45:07 -08:00
Jon Leighton
29452abb84
SQLite3 has supported savepoints since version 3.6.8, we should use this!
2011-01-11 13:45:07 -08:00
Jon Leighton
7f7b480098
When assigning a has_one, if the new record fails to save, raise an error
2011-01-11 13:45:07 -08:00
Jon Leighton
1bc71ed960
When assigning a has_one, if the existing record fails to be removed from the association, raise an error
2011-01-11 13:45:06 -08:00
Jon Leighton
c47c541402
Have a separate test connection directory for sqlite3 in-memory so that the tests can be run without having to specifically rename the connection file (which then causes git to pick up the changes)
2011-01-11 13:45:06 -08:00
Jon Leighton
80df74bf51
Enable the sqlite3 in-memory test connection to work
2011-01-11 13:45:06 -08:00
Jon Leighton
c6e10b0f60
has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle
2011-01-11 13:45:06 -08:00
Jon Leighton
665880c080
Return value is irrelevant here as the RHS of the assignment is always returned by methods ending in '='
2011-01-11 13:45:06 -08:00
Jon Leighton
15adcc3927
Remove incorrect documentation about build_assoc on has_one. This is proven, for example, by test_successful_build_association in has_one_associations_test.rb
2011-01-11 13:45:06 -08:00
Jon Leighton
00dc8f77a2
For a singular association, it should be build_association, rather than association.build (as association may be nil)
2011-01-11 13:45:06 -08:00
Jon Leighton
1390a44328
Correctly indent the bullet points under 'One-to-one associations', so that the lines are not broken in the generated rdoc html
2011-01-11 13:45:05 -08:00
Aaron Patterson
f6b71dea15
avoid splatting arrays by using concat
2011-01-11 13:45:05 -08:00
Santiago Pastorino
a61e3acef2
html_safe.to_str makes no sense
2011-01-11 18:57:35 -02:00
Ernie Miller
7d4d745730
Fix polymorphic belongs_to associationproxy raising errors when loading target.
2011-01-11 09:19:19 -08:00
Aaron Patterson
a60ea74222
only use one array when collecting split up queries
2011-01-10 17:30:40 -08:00
Aaron Patterson
1cc556dc52
adding to_d to BigDecimal
2011-01-10 15:51:37 -08:00
Raimonds Simanovskis
f4f4964ce0
Always return decimal average of integer fields
...
In previous version if database adapter (e.g. SQLite and Oracle) returned non-String calculated values then type_cast_using_column converted decimal average value of intefer field to integer value. Now operation parameter is always checked to decide which conversion of calculated value should be done.
2011-01-10 15:51:32 -08:00
Aaron Patterson
0616585619
use SQLite3::VERSION rather than the deprecated class
2011-01-10 11:40:19 -08:00
Krekoten' Marjan
366e7854ac
Refactor to handle the X-Cascade without having to raise an exception
2011-01-09 16:08:54 -08:00
Kevin Moore
3e2465521b
Aligning master changelog w/ 3-0-stable
2011-01-09 16:07:25 -08:00
Jakub Kuźma
5106ce88e4
authenticity_token option for form_tag [ #2988 state:resolved]
2011-01-09 15:55:26 -08:00
John Allison
5d1d9bfb05
Improve select helpers by allowing a selected value of false. This is useful when using a select helper with a boolean attribute, and the attribute is false. (e.g. f.select :allow_comments)
2011-01-09 15:45:55 -08:00
Katrina Owen
4690bee301
Adding postgresql template option when executing db:test:clone_structure
...
Specify the template to use in config/database.yml, e.g.
test:
adapter: postgresql
template: template_postgis
If no template is specified, postgresql defaults to template1
2011-01-09 15:35:47 -08:00
Rizwan Reza
18605adec3
HTML5 button_tag helper
...
This tag is similar in nature to submit_tag, but allows more control.
It also doesn't submit if submit type isn't used, allowing JavaScript to
control the flow where required.
For more information: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-button-element
2011-01-09 15:22:23 -08:00
Santiago Pastorino
2b2b50660b
Bump up bcrypt-ruby dependency to 2.1.4
2011-01-09 19:04:43 -02:00
Santiago Pastorino
75e89ed68e
Initialize these options as false if they are not given
2011-01-09 16:54:03 -02:00
Santiago Pastorino
14198d84a9
Remove InstanceTagMethods module and define the methods inside the InstanceTag class
2011-01-09 13:35:38 -02:00
Aaron Patterson
12f5158f09
remove unused string substitution
2011-01-08 20:15:15 -08:00
Aaron Patterson
3b677aa006
use select_all because not all database adapters support bind values
2011-01-08 19:59:31 -08:00
Aaron Patterson
ec960c3730
join the cult of cargo. reduce the number of NoMethodErrors in the system
2011-01-07 18:45:30 -08:00
Aaron Patterson
36d7bd1898
stop creating intermediate AR objects, just construct AR objects from a list of hashes
2011-01-07 18:45:17 -08:00
Aaron Patterson
84f81f5779
no need for to_sym
2011-01-07 16:50:44 -08:00
Aaron Patterson
33ebf9bd56
String#insert() mutates the string, so no need for lasgn
2011-01-07 16:27:34 -08:00
Aaron Patterson
1e2ab564f9
fewer funcalls to the cached attributes variable
2011-01-07 16:27:34 -08:00
Jeremy Kemper
63ed6ca998
Add test for e0e3adf
2011-01-07 16:25:25 -08:00
Jon Leighton
82b0ce9c97
Refactor HasOneAssociation#replace
2011-01-07 15:03:16 -08:00
Jon Leighton
5b28e52542
Don't not remove double negatives
2011-01-07 15:03:16 -08:00
Jon Leighton
d23c332e02
Clean up create, create! and build in HasOneAssociation
2011-01-07 15:03:15 -08:00
Jon Leighton
5ecf692248
merge_with_conditions is not necessary because the conditions will already be in the scope_for_create hash in the scope
2011-01-07 15:03:15 -08:00
Jon Leighton
45d0d18bae
Not really worth having the HasAssociation module for just a single method
2011-01-07 15:03:15 -08:00
Jon Leighton
770e6893b9
Construct an actual ActiveRecord::Relation object for the association scope, rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
2011-01-07 15:03:15 -08:00
Jon Leighton
441118458d
Use encode_with for marshalling
2011-01-07 15:03:15 -08:00
Aaron Patterson
2efd780dcb
send() will raise an ArgumentError, so we should leverage ruby
2011-01-07 14:30:20 -08:00