Commit Graph

16360 Commits

Author SHA1 Message Date
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
José Valim
f055bc05d5 Optimize the code added in fa99de0bd0 2010-05-15 21:55:03 +02:00
Jeremy Kemper
c5537c1158 Ruby 1.9: fix invalid rack response in test 2010-05-15 11:25:56 -07:00
Jeff Kreeftmeijer
da90fe9466 make sure as is set before trying to build an #{as}_counter. [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:19:41 -07: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
Jeff Kreeftmeijer
fa99de0bd0 partial counters with :as [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 10:32:23 -07: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
Anil Wadghule
2d84f24af5 Add tests for convenience methods #notice and #alert to flash.now [#4369 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 16:52:23 +02:00
Martin
e807476d31 added convenience methods #notice and #alert to flash.now
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 16:52:19 +02:00
Paco Guzman
cdf700147c fix assert_select messages to its declaration behaviour
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 16:31:36 +02:00
José Valim
6f0ed7aa52 Update generators test. 2010-05-15 15:21:14 +02: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
wycats
458f5712dc Remove the need for a special action_mailer.url_for initializer that loads before anything else 2010-05-15 06:09:07 -07:00
Jeroen van Dijk + Rodrigo Urubatan
80fc6536bd Added Rake task rails:templates:copy to copy templates for customization [#4574 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 14:59:29 +02:00
Carlos Antonio da Silva
c77794a924 Add missing require to with_options [#4601 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 14:54:07 +02: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
Adrian Sanchez
bcf5fea5e5 Bundler deprecated options in Gemfile with application template using method "gem" [#4534 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:43:20 +02:00
Marc-Andre Lafortune
9869ee77cd Accept :alt => nil on image_tag [#4558 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:43:15 +02:00
Santiago Pastorino
7ffe76046a ActiveResource shouldn't consider modules in the path
[#4529 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:38:32 +02:00
José Valim
d18a2742e0 Improve previous patch a bit [#3645 state:resolved] 2010-05-15 09:08:40 +02:00
Stephen Celis
6e69b42b21 Let label helpers accept blocks.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 08:59:08 +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
Mikel Lindsaar
4a8a62058a Changed encoding behaviour of mail, so updated tests in actionmailer and bumped mail version to 2.2.1
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-14 09:27:47 +02:00
Josh Kalderimis
92160219a8 minor changes to instance level validations implementation based on feedback from José Valim 2010-05-13 13:57:37 -07:00
Josh Kalderimis
9131a88bb8 validation macros can now be used within an instance 2010-05-13 13:57:37 -07:00
Xavier Noria
2203c781a7 defines prev_(month|year) in Date and Time to ease transition to 1.9, and deprecates last_(month|year) 2010-05-12 23:04:17 +02:00
Santiago Pastorino
903637f5f0 Fixes to_json and to_xml for ActiveResource
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-12 21:02:31 +02:00
Santiago Pastorino
6334006b81 Revert "Refactor of active_model/naming.rb and allow collection and element to be writable"
This reverts commit f7862b2c34.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-12 21:02:16 +02:00
Santiago Pastorino
bea3c26833 Make ActiveResource serialize XML correctly when element_name is set.
[#4529]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-12 09:31:36 -07:00
Santiago Pastorino
f7862b2c34 Refactor of active_model/naming.rb and allow collection and element to be writable
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-12 09:31:30 -07:00
Santiago Pastorino
42fa2714c5 Make use of to_xml and to_json in tests
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-12 09:31:30 -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
Xavier Noria
75ddbfecde Gemfile requires sqlite3-ruby 1.3.0.beta.1 2010-05-12 00:37:23 +02: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
Josh Kalderimis
446b0ffe1c corrected error message in session/cookie_store [#4546 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-10 12:37:01 +03: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
José Valim
06eaf27fff Merge branch 'master' of github.com:rails/rails 2010-05-09 13:02:55 +03:00
José Valim
6c2d974e15 Use annoted source code in Template:Error to avoid special cases in the show exceptions middleware. 2010-05-09 12:52:30 +03:00
Xavier Noria
e1a0d86fe0 Merge remote branch 'rails/master' 2010-05-09 11:46:45 +02:00