Not a failure per say, just wondering what's the proper way of doing this
we have a custom adder in one of our models like so
many_to_many :disabled_custom_products,
class: 'CustomProduct',
join_table:
:disabled_custom_products_locations,
right_key: :custom_product_id, left_key:
:location_id,
adder: (lambda do |custom_product, reason,
comment, available_at = nil|
DisabledCustomProductsLocation.update_or_create(
{ location_id: id,
custom_product_id: custom_product.id },
available_at: available_at,
reason: reason, comment: comment)
end)
My problem is that that custom adder has gotten too big and I'd like to
move it off the association declaration, but I've found that I can only
declare the lambda as a variable and have to do do it before the
association declaration (I can probably create a method too but that would
look even uglier defined before the relations)
Is there a better way of accomplishing this ?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/b7f94602-c75b-4c5f-850d-4b2dc798defen%40googlegroups.com.