Answer the question
In order to leave comments, you need to log in
How to create unique subpages in ROR posts?
Rails 4.0.1
Ruby 2.0.0p247
I don't use the admin panel.
Challenge:
Creating a subpage in a specific post?
Legend:
1) Create a new entry Animals under the name "animals." I enter the data "Title", "Description", save.
2) The page is available at www.foo.ru/bar/animals.
It is necessary that when creating the record "Animals" it was possible to create the pages of the view, Photos, Views, Countries. Which would be available at www.foo.ru/bar/animals/photo, etc.
Moreover, for each record, its own pages are created.
Tell me how this can be implemented?
Answer the question
In order to leave comments, you need to log in
If I understand correctly (and not a fact), then:
a) take Photos, Views, etc. separate models, in the routes to prescribe something like:
resources :animals do
resources :photos
...
end
get '*actions' => 'animals#mega_action'
You can make a Page model and routes
resources :animals do
member do
get ":page" => "pages#show"
end
end
scope '/animals/:id/:page', :constraints => PageConstraint
get '' => 'pages#show'
end
http://railscasts.com/episodes/403-dynamic-forms should help if the question is still relevant, you can download it from rutracker
get 'pages/:parent_page/'
get 'pages/:parent_page/:children_page'
get 'pages/:parent_page/:children_page/:children_children_page'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question