このアプリケーションでは、モデル Resource_Estimations は会社によって行われます。会社名の Resource_Estimations のデフォルトの並べ替え順序が必要です。
会社のモデル
class Company < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
...
has_many :resource_estimations, dependent: :destroy
...
validates :exchange_id, :name, :full_name, presence: true
Resource_Estimation モデル
class ResourceEstimation < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
...
belongs_to :company
...
validates :company_id, :drill_id, :resource_type_id, :date,
:fill_to_spill,:p10, :p50, :p90, presence: true
...
default_scope { order(:company => :asc) }
Resource_Estimation モデルの最後のステートメント (default_scope) を変更しようとしています。現在の company_id の並べ替え順序ではなく、並べ替え順序を company.name にしたいと考えています。多くのことを試しましたが、これまでのところ運がありません。どんな提案も歓迎します - ピエールに感謝します