Sha256: 4eed541c9e814697be33cd89837f0c1810585c08f788892976b942f1267ca616
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'jsonapi/resource' module DiscoApp::Admin::Resources::Concerns::ShopResource extend ActiveSupport::Concern included do attributes :shopify_domain, :status, :email, :country_name attributes :currency, :domain, :plan_display_name, :created_at attributes :pretty_created_at, :installed_duration model_name 'DiscoApp::Shop' filters :status # Adjust the base records method to ensure only models for the authenticated domain are retrieved. def self.records(options = {}) records = DiscoApp::Shop.order(created_at: :desc) records end # Apply filters. def self.apply_filter(records, filter, value, options) return records if value.blank? # Perform appropriate filtering. case filter when :status return records.where(status: value.map { |v| DiscoApp::Shop.statuses[v.to_sym] } ) else return super(records, filter, value) end end # Don't allow the update of any fields via the API. def self.updatable_fields(context) [] end # Don't allow the creation of any fields via the API. def self.creatable_fields(context) [] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
disco_app-0.8.9 | app/resources/disco_app/admin/resources/concerns/shop_resource.rb |