N
N
nanny_ogg2018-04-02 20:28:15
Ruby on Rails
nanny_ogg, 2018-04-02 20:28:15

How to create simple pages on Rails?

Good day. I'm a complete newbie to rails and I have a question about page addresses.
How to most competently create pages like site.ru/about, site.ru/contacts, etc.
In the manuals, it is usually advised to create a controller and use the appropriate actions for the pages. But here it turns out that the page address will be site.ru/pages/about. How to remove this very pages from the address? I can't google anything about this

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Z
Zaporozhchenko Oleg, 2018-04-02
@c3gdlk

create a StaticPagesController
and set the route as
get 'contacts' => 'static_pages#contacts'

N
nanny_ogg, 2018-04-03
@nanny_ogg

Decided like this - in routes.rb
Everything works, but how right / wrong is this? Is it normal to do this, or is it sotonism?

A
Andrey Demidenko, 2018-04-02
@Dem1

About, contacts and etc. it's all static. Put them in public

V
vsuhachev, 2018-04-04
@vsuhachev

есть гем high_voltage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question