"NoMethodError: undefined method `type' for "character varying":String" after "rake db:migrate"

I tried to add check-ins to micro-posts but I've got an error after rake db:migrate.. What does it mean?

Error

  $ rake db:migrate --trace
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Invoke db:load_config (first_time)
    ** Execute db:load_config
    ** Execute db:migrate
    rake aborted!
    NoMethodError: undefined method `type' for "character varying":String

add_checkin_to_microposts

 class AddCheckinToMicroposts < ActiveRecord::Migration
   def change
      add_column :microposts, :location, :point, :geographic => true
   end
 end

database.yml

 development:
  adapter: postgresql
  schema_search_path: public, postgis
  encoding: unicode
  database: blog_development
  host: localhost
  pool: 5
  username: ******** 
  password: 

Answers


Assuming you are using the gem activerecord-postgis-adapter, you'd better try to change the database adapter to postgis as recommended in their official document:

https://github.com/rgeo/activerecord-postgis-adapter


the problem that you are having is that point method does not exist in ActiveRecord.

Instantiates a new column for the table. The type parameter is normally one of the migrations native types, which is one of the following: :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :time, :date, :binary, :boolean.

For more info pleas read http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column

Hope this helps


Need Your Help

A quick way to change one letter when handling objects

c# object shortcut public

I've tried looking for a solution, but being very new I don't even know where to start.

fgets() not waiting for input

c fgets

I wrote the following code: