Rails

【Rails】 state_machineを使って状態を管理する

https://github.com/pluginaweek/state_machine今回はstate_machineを使ってUserモデルに状態を管理する機能を追加します。 インストールする # Gemfile gem 'state_machine' $ bundle install 使い方 # app/models/user.rb class User < ActiveRecord::Base…

Mac + Rails 環境構築メモ

Ruby のインストール ・rbenv, ruby-build, rbenv-gemset をインストールする $ brew install rbenv ruby-build rbenv-gemset・openssl, readline をインストールする $ brew install openssl $ brew install readline・パスを通すzsh の場合 # ~/.zshenv ex…

【Rails】 Authlogicでユーザー認証機能

ユーザー登録機能を作成する ・モデルを作成する $ rails g model User・マイグレーションファイルを修正する # db/migrate/20130125121017_create_users.rb class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :…