Hi,
I wonder what is preferred way of mounting Tim engine in Conductor. For UI Tim will be mounted at "/tim":
mount Tim::Engine, :at => "tim"

But Tim resources should be accessible through our API too (under /api),
there were two proposals how to do this:

1) mount Tim engine under /api, so Tim's resources will be nested:
scope "/api", :as => 'api' do
  mount Tim::Engine, :at => "tim" # other mountpoint name can be used
end

A disadvantage is that there will be another entrypoint for Tim:
https://gist.github.com/4474874
As Petr pointed out the entrypoint problem could be solved if Tim engine provides a method or partial which returns its resources - this would be then included directly in Conductor's entrypoint.


2) "include" Tim's resources in /api, so these resources will not be nested, I suppose this requires enumerate all Tim resources:
scope "/api", :as => 'api' do
resources :templates, :only => [:index, :create, :show, :update, :destroy] resources :base_images, :only => [:index, :create, :show, :update, :destroy]
  # same for the rest of resources
end

A disadvantage is that namespace safety is lost - e.g. if there will be 2 engines with resource 'template', we will have to do some resource renaming (sounds like a big problem to me) and it also requires to manage another chunk of code outside of Tim.


Unless there is strong disagreement till tomorrow, I will use option 1 which seems to be most reasonable option to me.

Jan

Reply via email to