mirror of
https://github.com/activerecord-hackery/ransack.git
synced 2022-11-09 13:47:45 -05:00
ActionView patch for Rails 4.2.1/5.0.0
This patch is needed for Rails 4.2.1 and 5.0.0 due to the following commit history in ActionView::Helpers::Tags: Rails 4.2: https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_ view/helpers/tags/translator.rb https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_ view/helpers/tags/placeholderable.rb (and label.rb too). Rails master: https://github.com/rails/rails/commits/master/actionview/lib/action_view /helpers/tags/translator.rb https://github.com/rails/rails/commits/master/actionview/lib/action_view /helpers/tags/placeholderable.rb (and label.rb too). Fixes #518. TODO: Find a better way to solve this. Pull requests welcome!
This commit is contained in:
parent
c2b316ca0a
commit
746f35e83b
1 changed files with 23 additions and 4 deletions
|
@ -1,17 +1,36 @@
|
||||||
require 'action_view'
|
require 'action_view'
|
||||||
|
|
||||||
# This patch is needed since this Rails commit:
|
# Monkey-patching, avert your eyes!
|
||||||
# https://github.com/rails/rails/commit/c1a118a
|
# TODO: Find a better way to solve these two issues:
|
||||||
#
|
|
||||||
# TODO: Find a better way to solve this.
|
|
||||||
#
|
#
|
||||||
module ActionView::Helpers::Tags
|
module ActionView::Helpers::Tags
|
||||||
|
|
||||||
|
# This patch is needed since this Rails commit:
|
||||||
|
# https://github.com/rails/rails/commit/c1a118a
|
||||||
|
#
|
||||||
class Base
|
class Base
|
||||||
private
|
private
|
||||||
def value(object)
|
def value(object)
|
||||||
object.send @method_name if object # use send instead of public_send
|
object.send @method_name if object # use send instead of public_send
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This patch is needed for Rails 4.2.1 and 5.0.0 since these commits:
|
||||||
|
#
|
||||||
|
# Rails 4.2:
|
||||||
|
# https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_view/helpers/tags/translator.rb
|
||||||
|
# https://github.com/rails/rails/commits/4-2-stable/actionview/lib/action_view/helpers/tags/placeholderable.rb
|
||||||
|
#
|
||||||
|
# Rails master:
|
||||||
|
# https://github.com/rails/rails/commits/master/actionview/lib/action_view/helpers/tags/translator.rb
|
||||||
|
# https://github.com/rails/rails/commits/master/actionview/lib/action_view/helpers/tags/placeholderable.rb
|
||||||
|
#
|
||||||
|
class Translator
|
||||||
|
def i18n_default
|
||||||
|
return '' unless model
|
||||||
|
["#{model}.#{method_and_value}".to_sym, ""]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RANSACK_FORM_BUILDER = 'RANSACK_FORM_BUILDER'.freeze
|
RANSACK_FORM_BUILDER = 'RANSACK_FORM_BUILDER'.freeze
|
||||||
|
|
Loading…
Reference in a new issue