LoginSignup
12
13

More than 5 years have passed since last update.

Railsいつも最初にやること

Last updated at Posted at 2015-01-29

僕がいつも最初にやること

Railsを用いるときに僕がいつも最初にやっていることをまとめておきます。基本的にはメモ用。何かこれもやっといた方がいいよとかあればコメントください。

App生成

ターミナル
#appの作成
$ rails new app_name
$ cd app_name

Gemファイルの追加

Gem
gem 'haml-rails' # ERB じゃなくて Haml を使いたい
gem 'therubyracer' #lessを使うために必要
gem "less-rails" #lessを使うよ宣言
gem 'twitter-bootstrap-rails' # Bootstrap の layout とかlessとかを generate してくれる
gem "font-awesome-rails" #fontawsomeを使えるように
gem 'pry-rails', :group => :development #デバッグ用

fontawsomeをコンパイルに追加

application.css
/*
 *= require font-awesome
 */

環境作成

ターミナル
$ bundle install #GemのInstall
$ rails g bootstrap:install # bootstrapファイルの生成
$ rake db:create #DBの生成
$ rails g bootstrap:layout application fixed #共通レイアウトの生成
$ rm app/views/layouts/application.html.erb #古いapplication.html.erbを削除

Gitの登録

ターミナル
$ git init
$ git add --all
$ git commit -m "first commit"

以上

あとはいつも通りControllerを作成したりModelを生成したり

$ rails g controller welcome index
$ rails g model Welcome name:string contents:integer
$ bundle install

rootを設定したり

config/routes.rb
root to: 'welcome#index'

好きなことをすればいいと思います

12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13