jasoncodes / activerecord_views

Automatic PostgreSQL database view creation for ActiveRecord
MIT License
35 stars 10 forks source link

Resolve inter-ActiveRecordView model dependencies (automatically?) #7

Closed parameme closed 9 years ago

jasoncodes commented 9 years ago

I can’t think of anything other than explicitly referencing the constants of the models which the view depends on.

If this list were passed into ActiveRecordViews, it could raise an error if there were any dependencies not listed (detectable via PostgreSQL after the view is created). This would act as a safety feature.

The list would have to be specified either as a part of the is_view call (probably as an options hash) or as another new method called before the is_view call (e.g. view_dependency). I am headed towards an option on is_view (e.g. is_view dependencies: [Foo]).