lib/alchemy/resources_helper.rb in alchemy_cms-7.0.0.pre.a vs lib/alchemy/resources_helper.rb in alchemy_cms-7.0.0.pre.b
- old
+ new
@@ -21,11 +21,11 @@
instance_variable_get("@#{resource_handler.resources_name}")
end
def resource_url_proxy
if resource_handler.in_engine?
- eval(resource_handler.engine_name)
+ eval(resource_handler.engine_name) # rubocop:disable Security/Eval
else
main_app
end
end
@@ -78,15 +78,15 @@
if attribute[:relation]
record = resource.send(attribute[:relation][:name])
value = record.present? ? record.send(attribute[:relation][:attr_method]) : Alchemy.t(:not_found)
elsif attribute_value && attribute[:type].to_s =~ /(date|time)/
localization_format = if attribute[:type] == :datetime
- options[:datetime_format] || :'alchemy.default'
+ options[:datetime_format] || :"alchemy.default"
elsif attribute[:type] == :date
- options[:date_format] || :'alchemy.default'
+ options[:date_format] || :"alchemy.default"
else
- options[:time_format] || :'alchemy.time'
+ options[:time_format] || :"alchemy.time"
end
value = l(attribute_value, format: localization_format)
else
value = attribute_value
end
@@ -108,12 +108,12 @@
options
when "date", "time", "datetime"
options.merge(
as: "string",
input_html: {
- data: { datepicker_type: input_type },
- },
+ data: {datepicker_type: input_type}
+ }
)
when "text"
options.merge(as: "text", input_html: {rows: 4})
else
options.merge(as: "string")
@@ -133,10 +133,10 @@
# Returns the attribute's column for sorting
#
# If the attribute contains a resource_relation, then the table and column for related model will be returned.
#
def sortable_resource_header_column(attribute)
- if relation = attribute[:relation]
+ if (relation = attribute[:relation])
"#{relation[:model_association].name}_#{relation[:attr_method]}"
else
attribute[:name]
end
end