Skip to content

Instantly share code, notes, and snippets.

class OrderFactory
attr_accessor :order
attr_reader :user
def initialize user, params
@user = user
@params = params&.symbolize_keys || {}
@Blohinyuriy
Blohinyuriy / base_controller.rb
Created October 10, 2016 20:09
One view in `app/views/application/` for all controllers where collection needs pagination
class BaseController
before_action :set_paginable_variant, only: :index
helper_method :paginated_collection
private
def set_paginable_variant
request.variant = :paginable if paginable?
end