Skip to content

Commit

Permalink
Rails 7 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolsto committed Mar 8, 2023
1 parent 5a878f6 commit 62d3554
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/sneaky-save.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,18 @@ def generate_insert_mapping(attributes)

def sneaky_attributes_values
attributes_for_create = send :attributes_for_create, attribute_names
attributes_with_values = send :attributes_with_values, attributes_for_create
attributes_with_values = sneaky_attributes_with_values(attributes_for_create)
attributes_with_values.each_with_object({}) do |attribute_value, hash|
hash[self.class.arel_table[attribute_value[0]]] = attribute_value[1]
end
end

def sneaky_attributes_with_values(attribute_names)
attribute_names.index_with do |name|
_read_attribute(name)
end
end

def quote(value)
# The built-in Sanitization of Rails does not handle time ranges very well. We work around this
# by manipulating ranges so that they are not seen as iterable and will be properly handled by
Expand Down

0 comments on commit 62d3554

Please sign in to comment.