Commit Graph

196 Commits

Author SHA1 Message Date
Jeremy Kemper
c548e21365 Bump git versions to 3.0.0.beta1 since we've released 2010-02-05 09:24:12 -08:00
Jeremy Kemper
459ecaf95d Submarine the rake-gemcutter dep in Rakefiles 2010-02-05 00:03:03 -08:00
Jeremy Kemper
7b81f5981f Fix task defines 2010-02-04 18:44:32 -08:00
Jeremy Kemper
c1785f3282 Release using gemcutter gem:push tasks 2010-02-04 18:28:45 -08:00
David Heinemeier Hansson
79817aa9e7 Move to 3.0.0.beta 2010-02-03 17:29:51 -08:00
Mikel Lindsaar
d1eed079e1 Merge branch 'master' of git://github.com/rails/rails 2010-02-02 10:51:19 +11:00
Carl Lerche
9f01dff9c2 Get rails tests running on bundler 0.9 2010-01-31 19:13:43 -08:00
Mikel Lindsaar
65ad16568c Updating copyright dates on all licenses 2010-02-01 10:10:53 +11:00
Mikel Lindsaar
a07d0f8786 Full update on ActiveModel documentation 2010-02-01 10:08:20 +11:00
Joshua Peek
db49c706b6 Axe AM state machine
We're going do it eventually, get it done before 3.0 is final.
2010-01-30 18:38:01 -06:00
José Valim
d6e2f5013c Drop AR I18n deprecation and simple use errors.messages as fallback. 2010-01-30 13:12:12 +01:00
Yehuda Katz
1a50d2e66a Stop overriding LoadError.new to return a MissingSourceError (and sometimes nil!) 2010-01-19 22:35:26 -08:00
Samuel Elliott
31ea83eb89 Adding Proc support to validation messages so that they can become a little more dynamic, allowing for customisations during the request [#3514 status:resolved].
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-17 14:40:10 +01:00
José Valim
afd0c06dfa Validates needs hash slice. 2010-01-17 09:57:16 +01:00
Pratik Naik
dba196cb7f Merge docrails 2010-01-17 03:26:20 +05:30
José Valim
b078f7fd39 Fix typos and add tests to ensure they will be caught the next time. 2010-01-11 23:38:35 +01:00
José Valim
017f5d5308 Fix typo by renaming :genre to :gender. 2010-01-09 00:18:07 +01:00
José Valim
7045c4c279 Allow validates to map some types to specific options. So now you can do:
validates :email, :presence => true, :format => /@/
  validates :genre, :inclusion => %w(m f)
  validates :password, :length => 6..20
2010-01-08 21:36:04 +01:00
José Valim
fa14d6d51e Compile length validator options still at the class level, so whenever the validator is called, it just needs to check for :maximum, :minimum and :is values. 2010-01-08 21:36:04 +01:00
José Valim
47a5fd4c4b Allow :if, :unless, :on, :allow_nil and :allow_blank as shared options in validates. 2010-01-07 19:23:59 +01:00
jamie
0a79eb7889 Add validates method as shortcut to setup validators for a given set of attributes:
class Person < ActiveRecord::Base
  include MyValidators

  validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 }
  validates :email, :presence => true, :email => true
end

[#3058 status:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-07 19:23:59 +01:00
José Valim
a25ef06956 Allow to specify default attributes names translation in I18n yml files.
For example, you could easily specify :created_at and :updated_at translations as:

  en:
    attributes:
      created_at: "Created at"
      updated_at: "Updated at"

This configuration is built on ActiveModel, so it means those translations are
shared between different ORMs as well (but always as a fallback).
2010-01-07 15:31:50 +01:00
José Valim
b0572ab2b6 Be sure to dup load paths before clearing the array. 2010-01-07 15:31:50 +01:00
José Valim
190ce3ab37 Errors messages are now moved from :activerecord.errors to simply :errors on I18n yml files. 2010-01-07 15:31:49 +01:00
Joshua Peek
e5ed62deea Autoload AR test case 2010-01-04 16:50:01 -06:00
Joshua Peek
640d9e7e32 Autoload AMo test case 2010-01-04 16:29:07 -06:00
Joshua Peek
2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
David Heinemeier Hansson
5e94d3e3ea Merge 2010-01-03 22:27:28 -08:00
David Heinemeier Hansson
532b11690f Change the ActiveModel::Base.include_root_in_json default to true for Rails 3 [DHH] 2010-01-03 22:02:10 -05:00
José Valim
4796be33a4 Add missing tests to Validators. 2010-01-03 17:14:50 +01:00
José Valim
08986ce290 Remove deprecated ActiveModel tests (%d and %s is no longer supported in error messages a couple months already) 2010-01-02 22:27:03 +01:00
José Valim
653fa4c10c Add naming to AMo::Lint 2010-01-02 22:27:02 +01:00
José Valim
7cc0a4cfa1 Use activerecord.errors.format as in Rails 2.3.5. 2010-01-02 22:27:02 +01:00
José Valim
5fdd0e80a4 Be sure to convert namespaced names to we have 'Parrots name' instead of 'Parrots.name' in error messages. 2010-01-02 22:27:02 +01:00
Jeremy Kemper
4f590b67b7 Ruby 1.9.2: explicit coercion check no longer needed; bug fixed upstream 2010-01-01 11:02:09 -08:00
Carl Lerche
ae7ada1fde Some railties cleanup:
* Rename <framework>/rails.rb -> <framework>/railtie.rb
	* Rails::Plugin -> Rails::Railtie
	* Rails::Plugin::Vendored -> Rails::Plugin
2009-12-31 13:12:52 -08:00
Carl Lerche
e749424dfa Rename rails.rb -> rails/all.rb and rails/core.rb -> rails.rb 2009-12-31 13:12:52 -08:00
Carl Lerche
a23f4b6aee Add a /rails.rb for each framework for consistency 2009-12-31 11:57:59 -08:00
José Valim
6d390671f6 Move ActiveRecord callbacks implementation to ActiveModel and make use of it.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2009-12-28 16:19:23 -08:00
Jeremy Kemper
632df063a3 Merge commit 'josevalim/validations' 2009-12-28 11:13:35 -08:00
Jeremy Kemper
292363c75f Use i18n 2009-12-27 15:17:44 -08:00
José Valim
74098e4cb6 No need to use ValidationsRepairHelper hack on ActiveModel anymore, Model.reset_callbacks(:validate) is enough. However, tests in ActiveRecord are still coupled, so moved ValidationsRepairHelper back there. 2009-12-23 13:30:58 +01:00
José Valim
e31077c9aa Small clean up in Naming and TTranslation tests. 2009-12-23 12:28:02 +01:00
José Valim
44cd9e0e71 ActiveRecord::Validations are now built on top of Validator as well. 2009-12-23 12:14:00 +01:00
José Valim
279067639f validates_each uses a BlockValidator. 2009-12-23 01:38:15 +01:00
José Valim
977a5c43b1 Added check_validity! to EachValidator and refactor existing ones. 2009-12-23 01:08:27 +01:00
Joshua Peek
f737c2d69b All AMo modules are safe to defer 2009-12-22 17:39:41 -06:00
José Valim
f1085f4128 Move validations in ActiveModel to validators, however all validatity checks are still in the class method. 2009-12-23 00:36:51 +01:00
Joshua Peek
ace20bd25e Flip deferrable autoload convention 2009-12-22 17:27:37 -06:00
José Valim
2476c5312d Validator is simply sent to validate method. However, the API needs to change, so validate accepts a record. 2009-12-22 23:12:21 +01:00