Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DealsController
- private
- def collection
- @collection ||= Deal.order(order_attributes).page(params[:page])
- end
- def order_attributes
- DealOrderAttributes.build updated_at: :desc, params
- end
- end
- class DealOrderAttributes
- def initialize attributes, params
- @attributes = attributes
- @params = @params.fetch(:order, {})
- end
- def build
- @attributes.merge params
- end
- private
- def params
- #
- # build params
- #
- end
- end
Add Comment
Please, Sign In to add comment