Growstuff/growstuff

View on GitHub
app/resources/api/v1/crop_resource.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Api
  module V1
    class CropResource < BaseResource
      immutable

      filter :approval_status, default: 'approved'

      has_many :plantings
      has_many :seeds
      has_many :harvests

      has_many :photos

      has_one :parent, class_name: 'Crop'

      attribute :name
      attribute :en_wikipedia_url

      attribute :perennial
      attribute :median_lifespan
      attribute :median_days_to_first_harvest
      attribute :median_days_to_last_harvest
    end
  end
end