This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆環境 | |
Mac OS X 10.6.8 Snow Leopard | |
◆インストール対象 | |
Xcode | |
MacPorts | |
Git | |
RVM | |
Ruby1.9.2 | |
Rails3.0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gemfile | |
----- | |
gem 'kaminari' | |
----- | |
$ bundle install | |
----- | |
Gem::Package::FormatError: no metadata found in /Users/(USER_NAME)/.rvm/gems/ruby-1.9.3-p125/cache/kaminari-0.13.0.gem | |
An error occured while installing kaminari (0.13.0), and Bundler cannot continue. | |
Make sure that `gem install kaminari -v '0.13.0'` succeeds before bundling. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
参考: | |
「Ruby 1.9.3 + Rails 3.2.1 で segmentation fault -> 解決」 | |
- [ http://somethingnew2.com/blog/archives/2012/02/ruby_193_rails_321_segmentation_fault.php ] | |
----- | |
rvm remove 1.9.3-p125 | |
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.rvm/bin | |
rvm pkg install iconv | |
rvm pkg install openssl | |
rvm install ruby-1.9.3 --with-openssl-dir=~$rvm_path/usr --with-iconv-dir=$rvm_path/usr | |
rvm use 1.9.3 --default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆コントローラに書いたメソッドをhelper_methodにする | |
controllers/application_controller.rb | |
----- | |
private | |
def current_user | |
@current_user ||= User.where( id: session[:user_id] ).first | |
end | |
helper_method :current_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆Gemfile | |
---------- | |
group :test do | |
gem 'rspec', '2.9.0' # Behavior Driven Development (BDD) for Ruby | |
gem 'rspec-core', '2.9.0' # RSpec runner and example groups. | |
gem 'rspec-expectations', '2.9.0' # RSpec matchers for should and should_not. | |
gem 'rspec-mocks', '2.9.0' # RSpec test double framework with stubbing and mocking. | |
gem 'rspec-rails', '2.9.0' # RSpec version 2.x for Rails version 3.x. | |
end | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆where | |
user_test = User.where( :id => 1 ) | |
user_test.class.name # => "ActiveRecord::Relation" | |
user_test.first.class.name # => "User" | |
user_test.all.class.name # => "Array" | |
user_test.all.first.class.name # => "User" | |
◆find | |
user_test2 = User.find( 1 ) | |
user_test2.class.name # => "User" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆config/environments/development.rb | |
---------- | |
# Expands the lines which load the assets | |
# config.assets.debug = true | |
config.assets.debug = false | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆参考ページ | |
Railsでfavicon.icoを表示する設定 - hrendohの日記 | |
- [ http://d.hatena.ne.jp/hrendoh/20111102/1320236055 ] | |
◆アイコンパス設定 | |
app/views/application.html.erb | |
※「favicon_link_tag」を追加する | |
----- | |
<head> | |
<title>TestList : <%= session[:project_name] %></title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#resupond_withで質問なのですが、エラーが起きた場合のデフォルトの挙動を変更する場合、 | |
respond_with(@content, :error => 'foo', :location => 'bar') | |
# とすればいいのでしょうか? #rails_q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆Heroku Deploy For Cedar | |
git add . && git commit -m "update" | |
git push heroku master | |
heroku run rake db:migrate | |
heroku logs -t | |
heroku open | |
◆GitHub Deploy |
OlderNewer