angularjs_scaffold icon indicating copy to clipboard operation
angularjs_scaffold copied to clipboard

Eliminating default Views

Open danielflueck opened this issue 12 years ago • 0 comments

Hi I was playing around with angularjs_scaffold. Great stuff! Thanks. - It took me a long time to figure out the whole process of generating the view. Now I understand it and did some changes in my application, so I can remove all the views from Rails and use just your template views.

At the moment for two models my routes.rb looks like the following:

class JsonRouter
  def self.matches?(request)
    request.format == 'json'
  end
end

Trainingracoon::Application.routes.draw do
   root :to => 'welcome#index'

  constraints JsonRouter do
    resources :trainers
    resources :firms
  end

  get "/*other" => "welcome#index"

end

This routes all the html requests (when initial loading or reloading a page) to welcome#index and uses your layout. All other requests with json are routed correctly. In this case I could remove all the views, which makes the code more readable.

Maybe you like to put this into your library. Thanks anyway. Daniel

danielflueck avatar Nov 19 '12 11:11 danielflueck