I'll be fine

技術ブログ

Ruby

【Ruby on Rails】Backbone.jsにinclude先の情報を渡す方法と注意点

次のような中間テーブルを挟むhas_manyなDB構造の場合 users table id email 1 test1@gmail.com 2 test2@gmail.com 3 test3@gmail.com 4 test4@gmail.com 5 test5@gmail.com users_services table id user_id service_id role 1 3 2 role1 2 2 1 role2 3 3 3…

【Ruby on Rails】ER図を自動生成する

1. graphvizのインストール brew install cairo pango graphviz # Homebrew on Mac OS X sudo port install graphviz # Macports on Mac OS X sudo aptitude install graphviz # Debian and Ubuntu2. gemのインストール Gemfileにrails-erdを追加 group :dev…

【Ruby on Rails, Rspec】Factorygirlでデータを作成する

createだとデータベースに保存される @user = FactoryGirl.create(:user) User id: 2, email: "MyString", password: "MyString", created_at: "2012-05-04 06:57:38", updated_at: "2012-05-04 06:57:38" buildだとデータベースに保存されないので、idやcre…

【Ruby on Rails】rspecでテストを書きながら新規登録、ログイン、アカウント削除を実装してみました

時間を重視で、名前が適当、デザイン適当、scaffold、 なのでドヤ顔できるレベルではありませんが。 https://github.com/YuuShigetani/rspec_practice

【Ruby on Rails】redirect_toでactionを指定するときのnoticeの書き方

redirect_to ({:action => 'login'}), :notice => 'plz login'

【Ruby on Rails】Double render errorのデバッグ

and return をつける render :index and return

【Ruby on Rails】railsでtwitter bootstrapを使う

Gemfileに以下を追記 gem 'twitter-bootstrap-rails'以下のコマンドを実行 $ bundle $ rails g bootstrap:install

【Ruby on Rails】scaffoldでつくったファイルを削除する

rails destroy scaffold "name"

Linux Mintでapache2のバーチャルホストでruby on railsを動かす

Ubuntuの方も変わらないと思うので参考にどうぞrubyのバージョンはrbenvで管理しているものを対象に書いていきます。 普通にpassengerとかを入れて実行すると、 can not load -- bundlerとエラーが出て詰んでました。。。 rbenvのインストール apt-getでいけ…