Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable caching of batch connect form values #539

Merged
merged 31 commits into from
Aug 4, 2020
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
add cacheable to the model
Michaud Reyna committed Jul 20, 2020
commit 98e4d85b3f673f2aa17f8fd3b3c5a78bf0ec32ea
14 changes: 13 additions & 1 deletion apps/dashboard/lib/smart_attributes/attribute.rb
Original file line number Diff line number Diff line change
@@ -34,7 +34,13 @@ def value
def value=(other)
@opts[:value] = other
end

def cacheable?(default_value)
if opts[:cacheable].nil?
default_value
else
to_bool(opts[:cacheable])
end
end
# Type of form widget used for this attribute
# @return [String] widget type
def widget
@@ -141,5 +147,11 @@ def unchecked_value
def reserved_keys
[:widget, :fixed, :options, :html_options, :checked_value, :unchecked_value, :required, :label, :help, :cacheable]
end

FALSE_VALUES=[ false, '', 0, '0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF', 'no', 'NO' ]

def to_bool(value)
! FALSE_VALUES.include?(value)
end
end
end