How do you make the root_url one level above the root/ and still keep the routes intact
I have a working application with proper routes.
The application then became shared with another application with a homepage below the two sites.
-- Root Homepage --
/ \
| |
Website 1 Website 2
Now when I go to my page, the site loads. But the functioning does not.
My Routes
match '/generate_csv/(:id)', :to => "main#generate_csv", :via => :post, :as => "generate_csv"
resources :main
root :to => 'main#new'
Currently, my application is prepended by rails/website_1
How can I get my routes to line up again?
UPDATE
So this resolves the #create method, but I am still trying to get tha开发者_运维技巧t first match route working..
scope "rails" do
resources :main
match 'main/generate_csv/(:id)', :to => "main#generate_csv", :via => :post, :as => "generate_csv"
end
The problem is solved by writing the routes twice. This can't be right:
scope "rails" do
resources :main
match 'main/generate_csv/(:id)', :to => "main#generate_csv", :via => :post, :as => "generate_csv"
end
resources :main
match 'main/generate_csv/(:id)', :to => "main#generate_csv", :via => :post, :as => "generate_csv"
root :to => 'main#new'
It might be easier to use a subdomain as an alternative when merging two separate sites by doing something like:
constraints(:subdomain => /website1/) do
match '/' => 'website2/dashboard#index'
end
Otherwise, maybe try a scope:
scope module => "website1" do
resources :main
end
精彩评论