Skip to content

Commit

Permalink
Merge branch 'master' into erbout
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Jun 6, 2008
2 parents 49c4c7b + e2c49e6 commit fec0f06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions actionpack/lib/action_view/helpers/tag_helper.rb
@@ -1,5 +1,6 @@
require 'cgi'
require 'erb'
require 'set'

module ActionView
module Helpers #:nodoc:
Expand All @@ -8,7 +9,8 @@ module Helpers #:nodoc:
module TagHelper
include ERB::Util

BOOLEAN_ATTRIBUTES = Set.new(%w(disabled readonly multiple))
BOOLEAN_ATTRIBUTES = %w(disabled readonly multiple).to_set
BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map(&:to_sym))

# Returns an empty HTML tag of type +name+ which by default is XHTML
# compliant. Set +open+ to true to create an open tag compatible
Expand Down Expand Up @@ -37,7 +39,7 @@ module TagHelper
# tag("img", { :src => "open & shut.png" }, false, false)
# # => <img src="open &amp; shut.png" />
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}" + (open ? ">" : " />")
"<#{name}#{tag_options(options, escape) if options}#{open ? ">" : " />"}"
end

# Returns an HTML block tag of type +name+ surrounding the +content+. Add
Expand Down Expand Up @@ -111,7 +113,6 @@ def tag_options(options, escape = true)
if escape
options.each do |key, value|
next unless value
key = key.to_s
value = BOOLEAN_ATTRIBUTES.include?(key) ? key : escape_once(value)
attrs << %(#{key}="#{value}")
end
Expand Down
11 changes: 8 additions & 3 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -2064,13 +2064,18 @@ def replace_named_bind_variables(statement, bind_vars) #:nodoc:
end

def expand_range_bind_variables(bind_vars) #:nodoc:
bind_vars.sum do |var|
expanded = []

bind_vars.each do |var|
if var.is_a?(Range)
[var.first, var.last]
expanded << var.first
expanded << var.last
else
[var]
expanded << var
end
end

expanded
end

def quote_bound_value(value) #:nodoc:
Expand Down

0 comments on commit fec0f06

Please sign in to comment.