Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rails/rails
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Apr 30, 2010
2 parents 91963e9 + 6b55947 commit 0fe8827
Show file tree
Hide file tree
Showing 91 changed files with 3,072 additions and 1,419 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -7,6 +7,9 @@ gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"

group :mri do
gem 'json'
gem 'yajl-ruby'

if RUBY_VERSION < '1.9'
gem "system_timer"
gem "ruby-debug", ">= 0.10.3"
Expand Down
3 changes: 1 addition & 2 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -291,8 +291,6 @@ class Base < AbstractController::Base
:parts_order => [ "text/plain", "text/enriched", "text/html" ]
}.freeze

ActiveSupport.run_load_hooks(:action_mailer, self)

class << self

def mailer_name
Expand Down Expand Up @@ -643,5 +641,6 @@ def insert_part(container, response, charset) #:nodoc:
container.add_part(part)
end

ActiveSupport.run_load_hooks(:action_mailer, self)
end
end
@@ -1,6 +1,8 @@
module Rails
module Generators
class MailerGenerator < NamedBase
source_root File.expand_path("../templates", __FILE__)

argument :actions, :type => :array, :default => [], :banner => "method method"
check_class_collision

Expand Down
4 changes: 4 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,9 @@
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*

* Fixed inconsistencies in form builder and view helpers #4432 [Neeraj Singh]

* Both :xml and :json renderers now forwards the given options to the model, allowing you to invoke them as render :xml => @projects, :include => :tasks [José Valim, Yehuda Katz]

* Renamed the field error CSS class from fieldWithErrors to field_with_errors for consistency. [Jeremy Kemper]

* Add support for shorthand routes like /projects/status(.:format) #4423 [Diego Carrion]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/caching/actions.rb
Expand Up @@ -133,7 +133,7 @@ def filter(controller)
body = controller._save_fragment(cache_path.path, @store_options)
end

body = controller.render_to_string(:text => cache, :layout => true) unless @cache_layout
body = controller.render_to_string(:text => body, :layout => true) unless @cache_layout

controller.response_body = body
controller.content_type = Mime[cache_path.extension || :html]
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/base.rb
Expand Up @@ -176,8 +176,6 @@ class << self
delegate :logger, :to => 'ActionController::Base', :allow_nil => true
end

ActiveSupport.run_load_hooks(:action_view, self)

attr_accessor :base_path, :assigns, :template_extension, :lookup_context
attr_internal :captures, :request, :controller, :template, :config

Expand Down Expand Up @@ -229,5 +227,7 @@ def punctuate_body!(part)
response.body_parts << part
nil
end

ActiveSupport.run_load_hooks(:action_view, self)
end
end
77 changes: 33 additions & 44 deletions actionpack/lib/action_view/helpers/date_helper.rb
Expand Up @@ -589,56 +589,50 @@ def initialize(datetime, options = {}, html_options = {})
@options = options.dup
@html_options = html_options.dup
@datetime = datetime
@options[:datetime_separator] ||= ' &mdash; '
@options[:time_separator] ||= ' : '
end

def select_datetime
# TODO: Remove tag conditional
# Ideally we could just join select_date and select_date for the tag case
order = date_order.dup
order -= [:hour, :minute, :second]
@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
@options[:discard_minute] ||= true if @options[:discard_hour]
@options[:discard_second] ||= true unless @options[:include_seconds] && !@options[:discard_minute]

# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
# valid (otherwise it could be 31 and february wouldn't be a valid date)
if @datetime && @options[:discard_day] && !@options[:discard_month]
@datetime = @datetime.change(:day => 1)
end

if @options[:tag] && @options[:ignore_date]
select_time
elsif @options[:tag]
order = date_order.dup
order -= [:hour, :minute, :second]

@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
@options[:discard_minute] ||= true if @options[:discard_hour]
@options[:discard_second] ||= true unless @options[:include_seconds] && !@options[:discard_minute]

# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
# valid (otherwise it could be 31 and february wouldn't be a valid date)
if @datetime && @options[:discard_day] && !@options[:discard_month]
@datetime = @datetime.change(:day => 1)
end

else
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
order += [:hour, :minute, :second] unless @options[:discard_hour]

build_selects_from_types(order)
else
"#{select_date}#{@options[:datetime_separator]}#{select_time}".html_safe
end
end

def select_date
order = date_order.dup

# TODO: Remove tag conditional
if @options[:tag]
@options[:discard_hour] = true
@options[:discard_minute] = true
@options[:discard_second] = true
@options[:discard_hour] = true
@options[:discard_minute] = true
@options[:discard_second] = true

@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)

# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
# valid (otherwise it could be 31 and february wouldn't be a valid date)
if @datetime && @options[:discard_day] && !@options[:discard_month]
@datetime = @datetime.change(:day => 1)
end
# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
# valid (otherwise it could be 31 and february wouldn't be a valid date)
if @datetime && @options[:discard_day] && !@options[:discard_month]
@datetime = @datetime.change(:day => 1)
end

[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
Expand All @@ -649,15 +643,12 @@ def select_date
def select_time
order = []

# TODO: Remove tag conditional
if @options[:tag]
@options[:discard_month] = true
@options[:discard_year] = true
@options[:discard_day] = true
@options[:discard_second] ||= true unless @options[:include_seconds]
@options[:discard_month] = true
@options[:discard_year] = true
@options[:discard_day] = true
@options[:discard_second] ||= true unless @options[:include_seconds]

order += [:year, :month, :day] unless @options[:ignore_date]
end
order += [:year, :month, :day] unless @options[:ignore_date]

order += [:hour, :minute]
order << :second if @options[:include_seconds]
Expand Down Expand Up @@ -937,10 +928,8 @@ def datetime_selector(options, html_options)
options[:include_position] = true
options[:prefix] ||= @object_name
options[:index] = @auto_index if @auto_index && !options.has_key?(:index)
options[:datetime_separator] ||= ' &mdash; '
options[:time_separator] ||= ' : '

DateTimeSelector.new(datetime, options.merge(:tag => true), html_options)
DateTimeSelector.new(datetime, options, html_options)
end

def default_datetime(options)
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/prototype_helper.rb
Expand Up @@ -767,7 +767,7 @@ def each_slice(variable, number, &block)
end

def grep(variable, pattern, &block)
enumerate :grep, :variable => variable, :return => true, :method_args => [pattern], :yield_args => %w(value index), &block
enumerate :grep, :variable => variable, :return => true, :method_args => [::ActiveSupport::JSON::Variable.new(pattern.inspect)], :yield_args => %w(value index), &block
end

def in_groups_of(variable, number, fill_with = nil)
Expand Down

0 comments on commit 0fe8827

Please sign in to comment.