class CashOrderStatus < ActiveRecord::Base
belongs_to:cash_order
end
usually the db need a table cash_order_statuses to mapping this model,but now i want to
mapping this model to a specific sql view like
select * from order_statues where cash_order_id is not null <=> CashOrderStatus
does rails provide some way to achieve this
There are multiple ways to fulfill your requirement:
So your model will look like this:
And OrderStaus model will be derived from AR::Base class. Try it.
NOTE: Sorry for the class inheritance notation. It should be < instead of >. There is formatting issue in my stackoverflow account, so I put like this 🙂