view page source - page history - about editing

Revision History: Ruby on Rails

This is revision 630 of the page Ruby on Rails, as it appeared on Thu, 11 Sep 2014 20:31:38 -0700.
  1. Rake
  2. Google OAuth2 with Ruby on Rails
  3. Using Capybara with Minitest for Integration Tests in Rails 4
  4. Loading seeds.rb data into test database through rake test
  5. Installing capybara-webkit on Ubuntu
  6. Enabling Jenkins support with Ruby on Rails tests

How I learnt Ruby on Rails

Following the Getting Started guide:
  1. Don't install the Cygwin version of Ruby or Ruby-rails. They will not work because I think cygwin paths get in the way of generating temporary files for Javascript compilation: Error: Cannot find module 'C:/cygdrive/c/DOCUME~1/Jevon/LOCALS~1/Temp/execjs20140124-6456-ws3la8.js' (in /usr/lib/ruby/gems/1.9.1/gems/turbolinks-2.2.0/lib/assets/javascripts/
  2. Install Ruby 1.9.3 from the Windows Installer package
  3. Install the Ruby 1.9.3 devkit: download the executable, extract it somewhere, follow the install instructions
  4. 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:
  1. Download into C:Railscacert.pem
  2. Go to your Computer -> Advanced Settings -> Environment Variables
  3. Create a new System Variable: SSL_CERT_FILE=C:Railscacert.pem
Close all your command prompts, including your rails server, and open up a new irb command prompt to test that it works:

$irb> require 'open-uri'
$irb> open('')

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

view page source - what links to here? - page history - top
Last edited by jevon jevon 50 months ago