Commit Graph

14180 Commits

Author SHA1 Message Date
Eloy Duran
7f775ef1a9 Renamed AssociationReflection #collection_association? to #collection?. 2010-01-08 21:47:17 +01:00
Eloy Duran
f2aacd5140 Rollback the transaction when one of the autosave associations fails to save. [#3391 state:resolved] 2010-01-08 21:45:02 +01:00
Lawrence Pit
5193fe9dd7 Exclude unchanged records from the collection being considered for autosave. [#2578 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2010-01-08 21:45:02 +01:00
Bryan Stearns
1080351437 Add failing test that triggers the stack overflow 2010-01-08 21:45:02 +01:00
José Valim
802b08da00 Mailer should give self as payload because it contains all the information needed (as the template rendered and the mailer name). 2010-01-08 21:36:04 +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
David Heinemeier Hansson
188d52165b Fixed that much of DateHelper wouldn't return html_safe? strings [DHH] 2010-01-08 11:49:12 -08:00
Eloy Duran
c7319f5fa0 Fixed french sentence so it actually makes sense. 2010-01-08 13:29:24 +01:00
David Heinemeier Hansson
5ea130943e Fixed that fragment caching should return a cache hit as html_safe (or it would all just get escaped) [DHH] 2010-01-07 17:45:32 -08:00
Mikel Lindsaar
1ddf17dff0 Return-Path per RFC needs '<' and '>' around the addr_spec 2010-01-08 12:17:12 +11:00
Jeremy Kemper
8087d51842 Liberalize picky test 2010-01-07 17:08:02 -08:00
Jeremy Kemper
1ca9c26301 Merge remote branch 'mikel/master' 2010-01-07 16:59:23 -08:00
Jeremy Kemper
ee85f15453 Qualify constant lookup in BasicObject 2010-01-07 16:43:25 -08:00
Mikel Lindsaar
82407f94aa Merge branch 'master' of github.com:mikel/rails
Conflicts:
	actionmailer/actionmailer.gemspec
	actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
2010-01-08 11:17:04 +11:00
Mikel Lindsaar
e2aa6712a1 Updating mail require 2010-01-08 11:13:46 +11:00
Jeremy Kemper
4300f94533 Revert "Remove connection method definition, since it's called just once."
Restore the connection method which was added so it can be overridden.

This reverts commit e428c75d2b67c6a7bd5f5e7e1719cdece84d497f.
2010-01-07 13:30:51 -08:00
José Valim
3022ce4f72 No more hacks to ensure generators are executed inside Rails.root. 2010-01-07 21:24:50 +01:00
José Valim
ccc9f0b7de Ensure application names are not singularized. 2010-01-07 21:09:32 +01:00
Joshua Peek
8fe66f1af0 Run railtie and plugin initializers before app specific ones 2010-01-07 14:01:34 -06:00
José Valim
19e7c524d2 Ensure config/application.rb also uses app_const instead of app_name.classify. 2010-01-07 20:59:26 +01:00
José Valim
423e2acbb7 Merge remote branch 'eloy/master' 2010-01-07 20:13:07 +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
Jeffrey Hardy
2dcc53bdbc Remove stray semicolon from cookie_verification_secret initialzer template 2010-01-07 11:51:54 -05:00
Jeffrey Hardy
f8352ec255 Align assignments in the session_store initializer template 2010-01-07 11:46:55 -05:00
José Valim
3b631df101 Ensure that segments in default_url_options also work with format specified. 2010-01-07 17:17:06 +01:00
José Valim
f149eb19d4 From now on, parameters defined in default_url_options can be absent from named routes.
This allows the following setup to work:

  # app/controllers/application_controller.rb
  class ApplicationController
    def default_url_options(options=nil)
      { :locale => I18n.locale }
    end
  end

  # From your views and controllers:
  I18n.locale                 #=> :en
  users_url                   #=> "/en/users"
  users_url(:pl)              #=> "/pl/users"
  user_url(1)                 #=> "/en/users/1"
  user_url(:pl, 1)            #=> "/pl/users/1"
  user_url(1, :locale => :pl) #=> "/pl/users/1"

If you provide all expected parameters, it still works as previously.
But if any parameter is missing, it tries to assign all possible ones
with the hash returned in default_url_options or the one passed straight
to the named route method.

Beware that default_url_options in ApplicationController is not shared
with ActionMailer, so you are required to always give the locale in your
email views.
2010-01-07 15:34:14 +01:00
José Valim
f564f947d9 Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
José Valim
598456b68b Updated the documentation for helpers.label. 2010-01-07 15:31:50 +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
c68cc49dcd Use helpers.label instead of views.labels. 2010-01-07 15:31:50 +01:00
José Valim
a091e2e4f6 errors in ActionView should not be namespaced as well. 2010-01-07 15:31:50 +01:00
José Valim
821a160a49 Add a deprecation message to activerecord.errors. 2010-01-07 15:31:49 +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
Eloy Duran
9550916903 Raise a RecordNotFound if an ID in nested attributes is given but doesn't return a record. [#2415 state:resolved] 2010-01-07 13:19:49 +01:00
Eloy Duran
b6264c43f4 Moved the validation logic to the association reflection and refactored autosave_association.rb a bit. 2010-01-07 13:19:48 +01:00
Eloy Duran
fc6aae3459 Remove deprecated '_delete' option from NestedAttributes. 2010-01-07 13:19:48 +01:00
Eloy Duran
a559260e41 Removed unnecessary call to #try and cleaned up a bit more. 2010-01-07 13:19:48 +01:00
Eloy Duran
f866ced24a Don't use strings for callbacks, as these will be evaled. Rather use symbols, which uses a direct method dispatch.
Patch by Comron Sattari. [#3429 state:resolved]
2010-01-07 13:19:48 +01:00
Eloy Duran
2171e0a1d1 Cleanup some code in nested_attributes.rb, autosave_association.rb, and associations.rb with AssociationReflection#collection_association?
Also cache the result value.
2010-01-07 13:19:48 +01:00
Eloy Duran
f82adc7c5a Add AssociationReflection#collection_association? which returns true if it's for a has_many or has_and_belongs_to_many association. 2010-01-07 13:19:48 +01:00
Eloy Duran
1afa9fa5a9 Refactored nested attributes a bit around :reject_if => :all_blank. 2010-01-07 13:19:48 +01:00
Jeremy Kemper
a323b83acf Remove unneeded reliance on super -> method_missing quirk 2010-01-07 00:06:20 -08:00
Jeremy Kemper
816ba1e15a Remove unneeded reliance on Numeric#round quirk 2010-01-06 23:35:03 -08:00
José Valim
74f6ccea20 instrumenter should be accessible from ActiveSupport::Notifications. 2010-01-06 22:24:16 +01:00
José Valim
0c2d933f36 Ensure before_validation and after_validation accepts :on as option. 2010-01-06 22:24:16 +01:00
Jeffrey Hardy
cfe0fcae06 Fix failing app generator test when using the --dev option 2010-01-06 14:22:51 -05:00
Jeffrey Hardy
caad6c634c Restore require of 'active_record/fixtures' for Rake tasks that use them 2010-01-06 13:58:27 -05:00