Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/subdivision_select/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ module SubdivisionSelect
#class CountryNotFoundError < StandardError;end
module TagHelper
def subdivision_option_tags
# In Rails 5.2+, `value` accepts no arguments and must also be called
# called with parens to avoid the local variable of the same name
# https://github.com/rails/rails/pull/29791
selected_option = @options.fetch(:selected) do
if self.method(:value).arity == 0
value
else
value(@object)
end
end

option_tags_options = {
selected: @options.fetch(:selected) { value(@object) },
selected: selected_option,
disabled: @options[:disabled]
}

Expand Down