Plural to Singular conversion trouble in Rails Migrations?

Posted by Earlz on Stack Overflow See other posts from Stack Overflow or by Earlz
Published on 2010-05-03T05:24:11Z Indexed on 2010/05/03 5:28 UTC
Read the original article Hit count: 259

Hi, I'm a beginner at Ruby On Rails and am trying to get a migration to work with the name Priorities

So, here is the code I use in my migration:

class Priorities < ActiveRecord::Migration
  def self.up
    create_table :priorities do |t|
      t.column :name, :string, :null => false, :limit => 32
    end
    Priority.create :name => "Critical"
    Priority.create :name => "Major"
    Priority.create :name => "Minor"
  end

  def self.down
    drop_table :priorities
  end
end

This results in the following error though:

NOTICE:  CREATE TABLE will create implicit sequence "priorities_id_seq" for serial column "priorities.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "priorities_pkey" for table "priorities"
rake aborted!
An error has occurred, this and all later migrations canceled:

uninitialized constant Priorities::Priority

Is this some problem with turning ies to y for converting something plural to singular?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about migrations