Commit Graph

3769 Commits

Author SHA1 Message Date
Rizwan Reza
d148a6f6ba Merge branch 'master' of git://github.com/rails/rails 2010-05-17 02:40:15 +04:30
Federico Brubacher
6b4e0cc526 a cloned object no longer mimics changed flags from creator , plus a test case [#4614 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 23:04:40 +02:00
Santiago Pastorino
821e15e5f2 Change on Array extension from rand => random_element [#4555 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-16 22:23:44 +02:00
Nobuhiro IMAI
5d0afe75eb prevent to run fixture accessor (e.g. test_foos for TestFoo model) as a test case [#2992 state:resolved]
Signed-off-by: Wijnand Wiersma <wijnand@videre.net>
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 20:14:36 +02:00
Santiago Pastorino
fdfebb7782 Make use of assert_equal to test equallity between object assert expects and object and a message of error
[#4611 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 16:06:28 +02:00
Wijnand Wiersma
d7a3e65c50 Postgresql doesn't allow to change a string type column to a binary type. Skip this test for postgresql for now. [#4616 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 15:15:43 +02:00
Elomar França
edec1afe25 Don't carry default value when changing column for a binary type on MySQL [#3234 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:45:26 +02:00
Neeraj Singh
5de2e0d416 better documentation for dependent option [#4564 state:resolved] 2010-05-16 06:47:16 +04:30
José Valim
d6cbb27e7b Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options."
Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object.

This reverts commit bc1c8d58ec.
2010-05-15 21:55:16 +02:00
Jeroen van Dijk
bc1c8d58ec Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options.
This makes it possible to pass additional options through Validators to message
generation. E.g. plugin authors want to add validates_presence_of :foo, :format
=> "some format".

Also, cleanup the :default vs :message options confusion in ActiveModel
validation message generation.

Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in
favor of ActiveModel::Errors#add_on_blank(attributes, options).

Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again

[#4057 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:17:58 -07:00
Santiago Pastorino
47c9a35506 Reset quoted_table_name after set_table_name [#4568 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-15 18:53:47 +01:00
Diego Algorta
3436fdfc12 Fix for get_ids when including a belongs_to association on a has_many association [#2896 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-15 16:53:59 +01:00
wycats
9cfeefb637 Reorganized initializers a bit to enable better hooks for common cases without the need for Railtie. Specifically, the following hooks were added:
* before_configuration: this hook is run immediately after the Application class 
  comes into existence, but before the user has added any configuration. This is
  the appropriate place to set configuration for your plugin
* before_initialize: This is run after all of the user's configuration has completed,
  but before any initializers have begun (in other words, it runs right after
  config/environments/{development,production,test}.rb)
* after_initialize: This is run after all of the initializers have run. It is an
  appropriate place for forking in a preforking setup

Each of these hooks may be used via ActiveSupport.on_load(name) { }. In all these cases, the context inside the block will be the Application object. This means that for simple cases, you can use these hooks without needing to create a Railtie.
2010-05-15 06:09:07 -07:00
Neeraj Singh
58adc67371 STI should not ignore type condition while applying scopes from parent class scopes
[#4507 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:48:49 +02:00
David Chelimsky + Brian Tatnall
35a114a894 Modified default_scope to merge with any pre-existing default_scope
and added AR::Base::clear_default_scope

- clear_default_scope provides users who rely on the old behaviour
  of each call to default_scope overwriting any previous default
  scopes an opportunity to maintain that behaviour.

[#4583 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 08:38:28 +02:00
Neeraj Singh
a0621c1086 Better code formatting and proper line numbers for stack traces
[#4596 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 12:24:01 -07:00
Santiago Pastorino
0c37bf8f91 To allow proper fisting of stack trace
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 10:36:59 -07:00
Xavier Noria
7321a3a7d3 revises the rdoc of #average according to 5f3bd55, and realigns when clauses 2010-05-12 08:47:55 +02:00
Santiago Pastorino
5f3bd55726 type_cast_calculated_value refactor: value is never a Fixnum here. Fix test since SQLite returns Float.
[#4514 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-11 22:29:26 -07:00
Blake Smith
a4207c1084 Make sure timestamp is properly referenced
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-11 20:06:26 +02:00
Pratik Naik
88b4a8fcaf Remove undocumented save_without_validation! 2010-05-11 15:39:29 +01:00
Pratik Naik
475d1d1713 Use arel instead of sql strings 2010-05-11 15:32:41 +01:00
Pratik Naik
1f675ea8c7 Succint save definition 2010-05-11 13:50:09 +01:00
José Valim
5c245b91d2 Make sure valid? preceives the context as in ActiveModel API (ht: Carlos Antonio) 2010-05-10 12:28:38 +03:00
Pratik Naik
ce5827ea47 Make sure schema dumper doesnt throw up when there are no index lengths 2010-05-09 12:43:06 +01:00
Pratik Naik
8d2f6c16e3 Revert "Revert "Add index length support for MySQL [#1852 state:open]""
This reverts commit 6626833db1.
2010-05-09 12:42:48 +01:00
Pratik Naik
f75a6fec29 Improve code from 231d7676f7 2010-05-09 12:33:25 +01:00
Josh Kalderimis
231d7676f7 corrected AR find_each and find_in_batches to raise when the user uses select but does not specify the primary key
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-09 13:14:47 +03:00
wycats
d916c62cfc eliminate alias_method_chain from ActiveRecord 2010-05-09 02:37:52 +03:00
Josh Kalderimis
e17ff6d617 updated AR to work with the AMo model validation changes 2010-05-08 23:51:36 +03:00
Santiago Pastorino
0b4211c88b Here the intention was to assign to different objects 2010-05-08 23:29:51 +03:00
Sam Ruby
788684d75a get the rescue error page back [#4536 state:resolved] 2010-05-08 17:55:51 +02:00
José Valim
6626833db1 Revert "Add index length support for MySQL [#1852 state:open]"
This commit breaks dumping a few tables, as the sessions table.
To reproduce, just create a new application and:

  rake db:sessions:create
  rake db:migrate
  rake db:test:prepare

And then look at the db/schema.rb file (ht: Sam Ruby).

This reverts commit 5b95730edc.
2010-05-08 17:46:39 +03:00
Emili Parreno
5b95730edc Add index length support for MySQL [#1852 state:resolved]
Example:

  add_index(:accounts, :name, :name => 'by_name', :length => 10)
  => CREATE INDEX by_name ON accounts(name(10))

  add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15})
  => CREATE INDEX by_name_surname ON accounts(name(10), surname(15))

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-08 12:39:46 +01:00
Santiago Pastorino
9aaef59356 Make find_or_create and find_or_initialize work mixing explicit parameters and a hash [#4457 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-07 09:40:02 -07:00
Ernie Miller
902861a43a Fix unintuitive behavior with multiple order and group clauses
[#4545 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-06 16:00:39 -07:00
Ernie Miller
5be49884b5 Prevent calling regexp on symbol in Ruby 1.9 in association_proxy
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-05 18:54:07 +01:00
Mathieu Arnold
38da0ace77 Use primary key in conditions, not 'id' [#4395 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-04 22:45:08 +01:00
Brian Lopez
7aad851c2e Allow pre-casted values (other than nil) to pass through from calculations un-touched
[#4514 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-04 11:57:52 -07:00
Pratik Naik
841c01fa0f Use class_inheritable_accessor for connection_handler 2010-05-04 17:51:22 +01:00
Lawrence Pit
9bd91b00b8 Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax for I18n
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-03 13:37:32 +02:00
Justin George
731d4392e4 Change event namespace ordering to most-significant first [#4504 state:resolved]
More work still needs to be done on some of these names
(render_template.action_view and render_template!.action_view particularly)
but this allows (for example) /^sql/ to subscribe to all
the various ORMs without further modification

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
Cezary Baginski
256a15c235 AR: fixed postgres fixture tests [#4519 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-01 18:53:07 -07:00
Xavier Noria
1b898cc946 say something about after_(commit|rollback) in callbacks.rb, the fact that their implementation is elsewhere is not important for rdoc purposes 2010-05-02 00:47:09 +02:00
Xavier Noria
6433c939c1 edit pass in the transactions preamble rdoc 2010-05-02 00:40:31 +02:00
Cezary Baginski
8b1b273c21 AR: fixed postgres transaction tests [#4519 state:commited]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-01 13:40:07 -07:00
José Valim
13867a3f5f Use %{} syntax in I18n (faster) instead of {{}}. 2010-05-01 12:54:52 +02:00
Xavier Noria
1ff954aaea after_(commit|rollback) rdoc, edit pass 2010-04-30 21:35:03 +02:00
Lawrence Pit
60504e62c8 to_xml with :include should skip_instruct on the included records [#4506 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-30 14:22:57 +02:00
Neeraj Singh
883f27aa9a test cases for record.to_xml [#458 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-30 13:19:30 +02:00