mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
This enables the Rubocop's Style/MultilineMethodCallIndentation cop with
indentend enforced style. Which makes you split multiline method calls like:
orders = Spree::Order
.an_scope
.another_scope
.where(id: list_of_ids)
It also autofixes the current violations and updates the
rubocop_todo.yml
26 lines
862 B
Ruby
26 lines
862 B
Ruby
module Api
|
|
class OrderCyclesController < Spree::Api::BaseController
|
|
respond_to :json
|
|
def managed
|
|
authorize! :admin, OrderCycle
|
|
authorize! :read, OrderCycle
|
|
@order_cycles = OrderCycle.ransack(params[:q]).result.managed_by(current_api_user)
|
|
render params[:template] || :bulk_index
|
|
end
|
|
|
|
def accessible
|
|
@order_cycles = if params[:as] == "distributor"
|
|
OrderCycle.ransack(params[:q]).result.
|
|
involving_managed_distributors_of(current_api_user).order('updated_at DESC')
|
|
elsif params[:as] == "producer"
|
|
OrderCycle.ransack(params[:q]).result.
|
|
involving_managed_producers_of(current_api_user).order('updated_at DESC')
|
|
else
|
|
OrderCycle.ransack(params[:q]).result.accessible_by(current_api_user)
|
|
end
|
|
|
|
render params[:template] || :bulk_index
|
|
end
|
|
end
|
|
end
|