Skip to content

Commit

Permalink
Fix value call on Rails 5.2 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
aafaq-hassan authored and oliverklee committed May 16, 2018
1 parent 1e6fdd2 commit 8ba36b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/currency_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ module ToCurrencySelectTag
def to_currency_select_tag(priority_currencies, options, html_options)
html_options = html_options.stringify_keys
add_default_name_and_id(html_options)
value = value(object)
value = if self.method(:value).arity == 0
value()
else
value(object)
end
content_tag('select', add_options(currency_options_for_select(value, priority_currencies), options, value), html_options)
end
end
Expand All @@ -113,4 +117,4 @@ def currency_select(method, priority_currencies = nil, options = {}, html_option
end
end
end
end
end

0 comments on commit 8ba36b8

Please sign in to comment.