Revision History: Ruby on Rails
This is revision 627 of the page Ruby on Rails, as it appeared on Thu, 11 Sep 2014 20:31:29 -0700.Ruby
- Google OAuth2 with Ruby on Rails
- Using Capybara with Minitest for Integration Tests in Rails 4
- Loading seeds.rb data into test database through rake test
- Installing capybara-webkit on Ubuntu
- Enabling Jenkins support with Ruby on Rails tests
How I learnt Ruby on Rails
Following the Getting Started guide:
- Install Ruby 1.9.3 from the Windows Installer package
- Install the Ruby 1.9.3 devkit: download the executable, extract it somewhere, follow the install instructions
- Install rails: gem install rails
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
On Windows, this error occurs because the Ruby on Rails install does not come with a server certificate package. As per this StackOverflow answer:
- Download http://curl.haxx.se/ca/cacert.pem into C:Railscacert.pem
- Go to your Computer -> Advanced Settings -> Environment Variables
- Create a new System Variable: SSL_CERT_FILE=C:Railscacert.pem
$irb> require 'open-uri' $irb> open('https://www.gmail.com')
Partial not rendering
Make sure you use <%= render 'form' %>, not the non-printing form without equals <% render 'form' %>. I'm guessing this is a different render to render text: in a controller.
Adding a new database field after generation
Initial generation of a database table:
rails generate model User openid_identity:string created_at:date name:string rake db:migrate
Adding a new field 'last_login':
rails generate migration add_last_login_to_users last_login:date rake db:migrate
Could not find generator monban:scaffold
The generators were moved into a separate Gem, monban-generators - add this to your Gemfile.
RuntimeError: @controller is nil: make sure you set it in your test's setup method.
Are you trying to write an integration test in test/integration/foo_test.rb? Make sure that you are using ActionDispatch::IntegrationTest as your test superclass, rather than ActionController::TestCase:
require 'test_helper' class FooTest < ActionDispatch::IntegrationTest def setup ...