Perfect for myself.
terminal.
$ rvm install 2.5.1
$ rvm use 2.5.1
terminal.
$ gem install rails -v 5.2.1 -N #6 for 6 series.0.2.1 or whatever.
$ rails _5.2.1_ new < app name >
Gemfile.
gem 'bootstrap', '~> 4.1.1'
gem 'jquery-rails', '~> 4.3.1'
gem 'bycript' #Since it is prepared from the beginning, uncomment it
・ Pagination gem'kaminari'
「kaminari x Rails6」
-User authentication implementation gem'device'
"How to use device"
Other summary articles etc. ・ 15 Ruby on Rails Gem that you will definitely want to use for beginners ・ Qiita article "Convenient Gem you should know if you do Rails"
terminal.
$ bundle install
terminal.
$ rails s -p Arbitrary port number#-It is ok even if there is no less than p. If not specified, it will be 3000
Access localhost: 3000 (or the specified port number) with a browser, and if the following page is displayed, it is ok
terminal.
$ rails generate model User name:string email:string password_digest:string
terminal.
$ rails generate model Articles title:string description:text
Add the following to the created migrate file
class AddUserIdToArticles < ActiveRecord::Migration[5.1]
def change
add_column :articles, :user_id, :int
end
end
terminal.
$ rails db:migrate
terminal.
$rails g controller Users index(If you make a user list) new edit
$rails g controller Home index
$rails g controller Sessions new #For login
$ git init #Create a local repository
$ git add .
$ git commit -m "first commit"
$git remote add origin URL of the repository created on Github
$ git push origin master
~ Create a new branch ~
$git branch Any branch name
~ Check for existing branches ~
$ git branch
~ Move to the branch you want to write ~
$git checkout The name of the branch you want to move
~ Push to the branch destination ~
$ git add .
$ git commit -m "first commit"
$git push origin The name of the branch you want to write
== Select the import destination branch ==
$ git checkout master
== Combine the branches you want to integrate into mater ==
$git merge The name of the branch you want to merge
== Send join information to GitHub ==
$ git push origin master
hoge.html.erb
#link_to
<%= link_to 'top page', root_path %>
<%= link_to “Move to Yahoo”, “http://www.yahoo.co.jp/” %>
<%= link_to “Delete”, member_path(params[:id]), method: :delete %>
Recommended Posts