Basic knowledge of Ruby on Rails

Ready to use Rails

Create a new project

terminal


$ rails new (Project name)

Web server startup (virtual environment)

terminal


$ rails s -b 0.0.0.0

Bulletin board automatic generation

terminal


$ rails generate scaffold article content:string

Database settings

terminal


$ rails db:migrate

Add a web page (when creating a page called Welcome)

terminal


$ rails generate controller welcome index

Set the Welcome page as the top page

config/routes.rb


Rails.application.routes.draw do
  get 'welcome/index'

  resources :articles
  root 'welcome#index'
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end

Link settings

<%= link_to '(Link text)',Link address(In the following cases, move to the created articles) %>

ruby:index.html.erb


<%= link_to 'Show list', articles_path %>

Add name column to database articles table

terminal


$ rails generate migration AdNameToArticle name:string

Don't forget to migrate.



 You can execute the process of calling data from the name column by writing the code as shown below.


#### **`python`**
```ruby

<%= article.name %>

Recommended Posts

Basic knowledge of Ruby on Rails
Ruby on Rails basic learning ①
Ruby on Rails Basic Memorandum
[Ruby on Rails] Introduction of initial data
[Rails] Addition of Ruby On Rails comment function
Let's summarize "MVC" of Ruby on Rails
part of the syntax of ruby ​​on rails
[Ruby on Rails] Japanese notation of errors
Explanation of Ruby on rails for beginners ①
[Ruby on rails] Implementation of like function
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
Implementation of Ruby on Rails login function (Session)
[Ruby on Rails] Until the introduction of RSpec
[Ruby] Basic knowledge of class instance variables, etc.
Summary of basic knowledge of Rails acquired by progate
Recommendation of Service class in Ruby on Rails
Ruby on Rails ~ Basics of MVC and Router ~
[Ruby on Rails] A memorandum of layout templates
[Ruby on Rails] Individual display of error messages
Ruby on rails learning record -2020.10.03
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
Commentary on partial! --Ruby on Rails
[Ruby] List of basic commands
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
Ruby on Rails validation summary
Review of Ruby basic grammar
Ruby on Rails <2021> Implementation of simple login function (form_with)
[Ruby on Rails] Asynchronous communication of posting function, ajax
Implementation of Ruby on Rails login function (devise edition)
Docker the development environment of Ruby on Rails project
[Ruby on Rails] Implementation of tagging function/tag filtering function
Explanation of Ruby on rails for beginners ⑥ ~ Creation of validation ~
Explanation of Ruby on rails for beginners ② ~ Creating links ~
Try using the query attribute of Ruby on Rails
Explanation of Ruby on rails for beginners ⑦ ~ Flash implementation ~
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] Read try (: [],: key)
[Ruby on Rails] yarn install --check-files
Review the basic knowledge of ruby that is often forgotten
Ruby on Rails variable, constant summary
[Ruby on Rails] Introduced paging function
Progate Ruby on Rails5 Looking Back
Ruby on Rails for beginners! !! Summary of new posting functions
How to use Ruby on Rails
Basic knowledge
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
[Ruby on Rails] Add / Remove Columns
[Ruby on Rails] Elimination of Fat Controller-First, logic to model-
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) Display of the database that got the id of the database
(Ruby on Rails6) "Erase" posted content