diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/asset_paths.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/error.rb | 3 |
3 files changed, 11 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/asset_paths.rb b/actionpack/lib/action_view/asset_paths.rb index 3ddd8bd552..4bbb31b3ee 100644 --- a/actionpack/lib/action_view/asset_paths.rb +++ b/actionpack/lib/action_view/asset_paths.rb @@ -1,6 +1,5 @@ require 'zlib' require 'active_support/core_ext/file' -require 'active_support/core_ext/module/delegation' module ActionView class AssetPaths #:nodoc: @@ -8,8 +7,6 @@ module ActionView attr_reader :config, :controller - delegate :invalid_asset_host!, :to => :controller, :prefix => false - def initialize(config, controller = nil) @config = config @controller = controller @@ -99,6 +96,10 @@ module ActionView @config.default_asset_host_protocol || (has_request? ? :request : :relative) end + def invalid_asset_host!(help_message) + raise ActionView::MissingRequestError, "This asset host cannot be computed without a request in scope. #{help_message}" + end + # Pick an asset host for this source. Returns +nil+ if no host is set, # the host if no wildcard is set, the host interpolated with the # numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4), diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index ace457df2e..f16e33d08d 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -117,6 +117,10 @@ module ActionView # select_tag "destination", "<option>NYC</option><option>Paris</option><option>Rome</option>".html_safe, :disabled => true # # => <select disabled="disabled" id="destination" name="destination"><option>NYC</option> # # <option>Paris</option><option>Rome</option></select> + # + # select_tag "credit_card", options_for_select([ "VISA", "MasterCard" ], "MasterCard") + # # => <select id="credit_card" name="credit_card"><option>VISA</option> + # # <option selected="selected">MasterCard</option></select> def select_tag(name, option_tags = nil, options = {}) option_tags ||= "" html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb index f2bef4bded..e00056781d 100644 --- a/actionpack/lib/action_view/template/error.rb +++ b/actionpack/lib/action_view/template/error.rb @@ -8,6 +8,9 @@ module ActionView class EncodingError < StandardError #:nodoc: end + class MissingRequestError < StandardError #:nodoc: + end + class WrongEncodingError < EncodingError #:nodoc: def initialize(string, encoding) @string, @encoding = string, encoding |