Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cannot use POSITION in actionview to map value key
- Loading branch information
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ module TimelinessDateTimeSelect | |
# It's a minor usability improvement which is rarely an issue for the user. | ||
attr_accessor :object_name, :method_name, :template_object, :options, :html_options | ||
|
||
POSITION = { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
adzap
Author
Owner
|
||
:year => 1, :month => 2, :day => 3, :hour => 4, :min => 5, :sec => 6 | ||
}.freeze | ||
|
||
def initialize(object_name, method_name, template_object, options, html_options) | ||
@object_name, @method_name = object_name.to_s.dup, method_name.to_s.dup | ||
@template_object, @options, @html_options = template_object, options, html_options | ||
|
@@ -21,7 +25,7 @@ def value(object) | |
values = {} | ||
pairs.each_pair do |key, value| | ||
position = key[/\((\d+)\w+\)/, 1] | ||
values[::ActionView::Helpers::DateTimeSelector::POSITION.key(position.to_i)] = value.to_i | ||
values[POSITION.key(position.to_i)] = value.to_i | ||
end | ||
|
||
values | ||
|
@adzap I would like to know more about this change. I prefer using already defined constants from framework instead of redefining new. So that if any changes are done to the constant our code will adapt to the change.
There must be some reason you did this change. Can you tell me the purpose?