Skip to content

Commit

Permalink
Fix form_for use of datetime_select and date_select as well as a few …
Browse files Browse the repository at this point in the history
…stylistic upgrades to AR

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3330 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Dec 21, 2005
1 parent 71dcc69 commit 43f6643
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions actionpack/lib/action_view/helpers/date_helper.rb
Expand Up @@ -76,8 +76,8 @@ def time_ago_in_words(from_time, include_seconds = false)
# date_select("user", "birthday", :order => [:month, :day])
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
def date_select(object, method, options = {})
InstanceTag.new(object, method, self).to_date_select_tag(options)
def date_select(object_name, method, options = {})
InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_date_select_tag(options)
end

# Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a specified datetime-based
Expand All @@ -87,8 +87,8 @@ def date_select(object, method, options = {})
# datetime_select("post", "written_on", :start_year => 1995)
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
def datetime_select(object, method, options = {})
InstanceTag.new(object, method, self).to_datetime_select_tag(options)
def datetime_select(object_name, method, options = {})
InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_datetime_select_tag(options)
end

# Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+.
Expand Down
7 changes: 4 additions & 3 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -851,9 +851,10 @@ def with_scope(method_scoping = {})
hash
end

method_scoping.assert_valid_keys [:find, :create]
method_scoping.assert_valid_keys([ :find, :create ])

if f = method_scoping[:find]
f.assert_valid_keys [:conditions, :joins, :from, :offset, :limit, :readonly]
f.assert_valid_keys([ :conditions, :joins, :from, :offset, :limit, :readonly ])
f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
end

Expand Down Expand Up @@ -1448,7 +1449,7 @@ def update

# Creates a new record with values matching those of the instance attributes.
def create
if self.id.nil? and connection.prefetch_primary_key?(self.class.table_name)
if self.id.nil? && connection.prefetch_primary_key?(self.class.table_name)
self.id = connection.next_sequence_value(self.class.sequence_name)
end

Expand Down

0 comments on commit 43f6643

Please sign in to comment.