bwlang / odata_server

A fork of Mark Borkum's OdataOnRails plugin
MIT License
17 stars 26 forks source link

Started work on Rails3 Engine #3

Open wtfiwtz opened 11 years ago

wtfiwtz commented 11 years ago

Here's the first bit...

You need to add the gem to your Gemfile:

gem 'odata_server', :path => '/Developer/odata_server'

OR

gem 'odata_server', :git => 'git://github.com/wtfiwtz/odata_server.git', :branch => 'rails3'

... and setup the routes in config/routes.rb into your application:

mount OdataServer::Engine, :at => 'OData' #, :namespace => 'OdataServer'

scope '/OData' do with_options :controller => :o_data do |o_data| o_data.match "/OData.svc", :action => "service" o_data.match "/OData.svc/$metadata", :action => "metadata" o_data.match "/OData.svc/*#{ODataController.path_param.to_s}", :action => "resource"

  o_data.match "/",                                     :action => "redirect_to_service"
  o_data.match "/$metadata",                           :action => "redirect_to_metadata"
  o_data.match "/*#{ODataController.path_param.to_s}", :action => "redirect_to_resource"
end

I cannot get Rails 3.x Isolated Engines to work correctly due to a namespace issue.