Ruby on Rails Friday, September 19, 2014



On Thursday, 18 September 2014 19:52:05 UTC-4, Ruby-Forum.com User wrote:
I'm having an issue with one migration.  all other migrations work ok.

Here's the output:
== 20140905145859 CreateMemberships: migrating
================================
-- create_table(:memberships)
   -> 0.3010s
== 20140905145859 CreateMemberships: migrated (0.3011s)
=======================


But here's what it looks like in rails c:
Loading development environment (Rails 4.0.5)
2.0.0-p481 :001 > Membership
 => Membership()

Here's the content of the migration:
class CreateMemberships < ActiveRecord::Migration
  def change
    create_table :memberships do |t|
      t.string :user_id

      t.timestamps
    end
  end
end


Any ideas why this one migration has problems?


If you do `Membership.first` in the console, what happens?

Usually when this sort of weirdness happens to me, it's because some other class/module in the app is getting named `Membership`, which makes a real mess.

--Matt Jones 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0104d282-2906-41a3-86ef-41a6660946f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment