0

I'm trying to create a rails app, but somethings going wrong, I'm getting a nasty error undefined methodtitle' for #`

I've used this ling:

ruby script/generate scaffold Blog title:String body:text

to generate the following migration file:

class CreateBlogs < ActiveRecord::Migration
 def self.up
  create_table :blogs do |t|
    t.String :title
    t.text :body

    t.timestamps
  end
end

 def self.down
  drop_table :blogs
 end
end

Upon inspection of the database, there's no 'title' column. I've tried this with a few different names and for whatever reason, even though there's two columns along with the timestamps in the migration file, after I've run rake db:migrate there's only one field in addition to the timestamps and id. Not sure why my 'title' field isn't being created :(

1 Answer 1

2

Shouldn't string be a lowercase 'S'?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.