Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing Rails 3 Routes in Database

By question is actually pretty simple. I'd just like to know if anybody was able to load their Rails 3 routes into a database so that they could be manipulated without server access from an admin panel like Typus. If anyone has pulled this off or knows of an effective way to do it, please let me know as I am really curious to pull this off on Rails 3.

like image 515
Robert Klubenspies Avatar asked Feb 23 '11 00:02

Robert Klubenspies


People also ask

How many types of routes are there in Rails?

Rails RESTful Design which creates seven routes all mapping to the user controller. Rails also allows you to define multiple resources in one line.

Where are routes defined in Rails?

In Rails, the routes of your application live in config/routes. rb . The Rails router recognises URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

What is the difference between member and collection in Rails route?

Considering the same case, the two terms can be differentiated in a simple way as :member is used when a route has a unique field :id or :slug and :collection is used when there is no unique field required in the route.

What are resourceful routes Rails?

Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. A single call to resources can declare all of the necessary routes for your index , show , new , edit , create , update , and destroy actions.


1 Answers

You may have to handle your own dispatching with a route like "*path". Then /foo/bar/123 would route to a controller of your choice where params[:path] is an array ['foo', 'bar', '123']. Then you could do whatever from there.

like image 140
Alex Wayne Avatar answered Sep 19 '22 12:09

Alex Wayne