Mercurial > hg > soundsoftware-site
comparison config/initializers/10-patches.rb @ 1526:404aa68d4227
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 11 Sep 2014 12:46:20 +0100 |
parents | dffacf8a6908 |
children |
comparison
equal
deleted
inserted
replaced
1493:a5f2bdf3b486 | 1526:404aa68d4227 |
---|---|
89 end | 89 end |
90 end | 90 end |
91 | 91 |
92 ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe } | 92 ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe } |
93 | 93 |
94 # HTML5: <option value=""></option> is invalid, use <option value=""> </option> instead | |
95 module ActionView | |
96 module Helpers | |
97 class InstanceTag | |
98 private | |
99 def add_options_with_non_empty_blank_option(option_tags, options, value = nil) | |
100 if options[:include_blank] == true | |
101 options = options.dup | |
102 options[:include_blank] = ' '.html_safe | |
103 end | |
104 add_options_without_non_empty_blank_option(option_tags, options, value) | |
105 end | |
106 alias_method_chain :add_options, :non_empty_blank_option | |
107 end | |
108 | |
109 module FormTagHelper | |
110 def select_tag_with_non_empty_blank_option(name, option_tags = nil, options = {}) | |
111 if options.delete(:include_blank) | |
112 options[:prompt] = ' '.html_safe | |
113 end | |
114 select_tag_without_non_empty_blank_option(name, option_tags, options) | |
115 end | |
116 alias_method_chain :select_tag, :non_empty_blank_option | |
117 end | |
118 | |
119 module FormOptionsHelper | |
120 def options_for_select_with_non_empty_blank_option(container, selected = nil) | |
121 if container.is_a?(Array) | |
122 container = container.map {|element| element.blank? ? [" ".html_safe, ""] : element} | |
123 end | |
124 options_for_select_without_non_empty_blank_option(container, selected) | |
125 end | |
126 alias_method_chain :options_for_select, :non_empty_blank_option | |
127 end | |
128 end | |
129 end | |
130 | |
94 require 'mail' | 131 require 'mail' |
95 | 132 |
96 module DeliveryMethods | 133 module DeliveryMethods |
97 class AsyncSMTP < ::Mail::SMTP | 134 class AsyncSMTP < ::Mail::SMTP |
98 def deliver!(*args) | 135 def deliver!(*args) |
163 "Setting the session secret with ActionController.session= is no longer supported in Rails 3." | 200 "Setting the session secret with ActionController.session= is no longer supported in Rails 3." |
164 exit 1 | 201 exit 1 |
165 end | 202 end |
166 end | 203 end |
167 end | 204 end |
205 | |
206 if Rails::VERSION::MAJOR < 4 && RUBY_VERSION >= "2.1" | |
207 module ActiveSupport | |
208 class HashWithIndifferentAccess | |
209 def select(*args, &block) | |
210 dup.tap { |hash| hash.select!(*args, &block) } | |
211 end | |
212 | |
213 def reject(*args, &block) | |
214 dup.tap { |hash| hash.reject!(*args, &block) } | |
215 end | |
216 end | |
217 | |
218 class OrderedHash | |
219 def select(*args, &block) | |
220 dup.tap { |hash| hash.select!(*args, &block) } | |
221 end | |
222 | |
223 def reject(*args, &block) | |
224 dup.tap { |hash| hash.reject!(*args, &block) } | |
225 end | |
226 end | |
227 end | |
228 end | |
229 | |
230 require 'awesome_nested_set/version' | |
231 | |
232 module CollectiveIdea | |
233 module Acts | |
234 module NestedSet | |
235 module Model | |
236 def leaf_with_new_record? | |
237 new_record? || leaf_without_new_record? | |
238 end | |
239 alias_method_chain :leaf?, :new_record | |
240 # Reload is needed because children may have updated | |
241 # their parent (self) during deletion. | |
242 if ::AwesomeNestedSet::VERSION > "2.1.6" | |
243 module Prunable | |
244 def destroy_descendants_with_reload | |
245 destroy_descendants_without_reload | |
246 reload | |
247 end | |
248 alias_method_chain :destroy_descendants, :reload | |
249 end | |
250 else | |
251 def destroy_descendants_with_reload | |
252 destroy_descendants_without_reload | |
253 reload | |
254 end | |
255 alias_method_chain :destroy_descendants, :reload | |
256 end | |
257 end | |
258 end | |
259 end | |
260 end |