Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:42:56+00:00 2026-06-18T12:42:56+00:00

I am having basic rails issue during migrations. Here are the two scripts class

  • 0

I am having basic rails issue during migrations. Here are the two scripts

class CreateGoogleMaps < ActiveRecord::Migration
  def self.up
    create_table :google_maps do |t|
      t.string :name, :null => false
      t.string :description
      t.column "center", :point, :null => false, :srid => 4326, :with_z => false # 4326: WSG84
      t.integer :zoom
      t.datetime :created_at
      t.datetime :updated_at
      t.integer :created_by_id
      t.integer :updated_by_id
    end
  end

  def self.down
    drop_table :google_maps
  end
end

File #2
+++ 003_add_map_style.rb ++++++

class AddMapStyle < ActiveRecord::Migration
  def self.up
      add_column :google_maps, :style, :integer
      GoogleMaps.update_all( "style = 1")
  end

  def self.down
      remove_column :google_maps, :style
  end
end
***********************************************

Here’s what I’m seeing during migration
== CreateGoogleMaps: migrating ===============================================
— create_table(:google_maps)
-> 0.0638s
== CreateGoogleMaps: migrated (0.0640s) ======================================

== CreateMarkers: migrating ==================================================
— create_table(:markers)
-> 0.0537s
== CreateMarkers: migrated (0.0539s) =========================================

== AddMapStyle: migrating ====================================================
— add_column(:google_maps, :style, :integer)
-> 0.0406s
rake aborted!
An error has occurred, all later migrations canceled:

uninitialized constant AddMapStyle::GoogleMaps

I’m using Rails 2.3.11. Any debugging tip is greatly appreciated !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:42:57+00:00Added an answer on June 18, 2026 at 12:42 pm

    You can safely use Models in migrations like so:

    class AddMapStyle < ActiveRecord::Migration
      class GoogleMaps < ActiveRecord::Base; end
    
      def self.up
          add_column :google_maps, :style, :integer
          GoogleMaps.update_all( "style = 1")
      end
    
      def self.down
          remove_column :google_maps, :style
      end
    end
    

    Since the class is defined inside the migration class, it is in a separate namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue while developing a basic Rails application. I've implemented Twitter Bootstrap
I am having a basic issue here with linq . Though this can be
I'm having a linking issue with a basic C++ program. No, I'm not including
I have a couple of basic Rails problems that I'm having trouble finding relevant
I think I'm having a basic understanding problem here and I hope someone can
So I am having a very basic issue. I have this UITableView within a
I'm having an issue with jQuery on Rails 3.2.8. I've installed the jquery-rails gem
Having deployed a very basic Rails 3.2.3 trial site to a production server (not
I'm having a rather basic problem, I've looked around (here, google, etc) and haven't
I am having a basic mysql stored procedure for inserting user data along with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.