SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    Karkala, India
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    heroku db:migrate error

    HTML Code:
    class MapCities < ActiveRecord::Migration
      def up
        TelephoneRecord.all.each do |tel|
          phone_record = PhoneRecord.new({
            :name => tel.name,
            :phone_no => tel.phone_no,
            :address => tel.address
          })
          phone_record.city = City.find_or_create_by_name(tel.selectcity)
          phone_record.save
        end
        drop_table :telephone_records
      end
    end
    when i try to deploy on this state heroku db:migrate it says uninitialized constant MapCities::TelephoneRecord then i changed it to following

    HTML Code:
    class MapCities < ActiveRecord::Migration
      def up
         create_table :telephone_records do |tel|
          phone_record = PhoneRecord.new({
            :name => tel.name,
            :phone_no => tel.phone_no,
            :address => tel.address
          })
          phone_record.city = City.find_or_create_by_name(tel.selectcity)
          phone_record.save
        end
        drop_table :telephone_records
      end
    end
    now the error is undefined method 'name' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::Tabledefination:0x000000043c17f8>

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    http://blog.heroku.com/archives/2009...d_from_heroku/

    Try pushing your database using this:
    Code:
    heroku db:push
    The reason it's saying TelephoneRecord doesn't exist is because that model is no longer in your code.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    Karkala, India
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it worked everything went fine finally i was able to push to heroku destructive action was given as warning now the problem is i am not able to search records in heroku????

    http://furious-earth-6304.herokuapp.com/phone_records

    localhost:3000/phone_records its perfect

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2012
    Location
    Karkala, India
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    done it mark actually i was typing small a when i typed capital a done how silly mistake it was but tell me is there a way to handle this case sensitiveness in forms

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    You'll find a google search faster than my response.

    https://www.google.com.au/search?q=r...ve+LIKE+search


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •