I used to write what I learned and did in my notebook, but I can't remember it with this alone, so I will write it in Qiita as well. I will only write really simple things. I will write it for myself.
"How to create a homepage with rails"
rails generate contoller home top
Doing this will create two files. Something like a file. One is top.html.erb Second home_controller
Explanation of the first top.html.erb ・ This is made in view If you put characters and html here, it will be reflected.
When adding, create a file in home ○○ .html.erb-like feeling
Description of the second home_controller ・ This is made in the controller Def top is written on the controller You cannot access without it.
When adding def ○○○
By the way, if get "home / top" => "home # top" is not written in the routing, an error will occur. get URL => Controller name # Action name
that's all
Recommended Posts