scientiffic
scientiffic

Reputation: 9415

nested routes with static pages in rails app

I'm currently rendering some static pages in my routes.rb as follows:

  get "home/index"
  get "about", to: "home#about"
  get "help", to: "home#help"
  get "news", to: "home#news"
  get "mobile", to: "home#mobile"

Under my "views" folder, I have a "home" folder that then contains "about.html", "help.html", etc. I want to have a page "android" that appears nested under mobile, i.e.

/mobile/android

How would I set this up in my routes, and where would I put the corresponding view?

Upvotes: 0

Views: 163

Answers (1)

Maksim Gladkov
Maksim Gladkov

Reputation: 3079

It is usually not a very good idea to handle static pages like this, but if you only need to add one page, then I would it so:

config/routes.rb

get "mobile/android", to: "home#mobile_android"

And add new mobile_android.html file in home folder, as you already did.

But again, it's not a great idea to handle static pages in rails like that.

Upvotes: 1

Related Questions