1

所以我正在使用 googlemaps API,我希望能够在地图上的数据库中搜索商店。我也在使用 geokit-rails gem。但是,我在 form_for(@song) 上收到以下错误:

First argument in form cannot contain nil or be empty

查询控制器:

class QueriesController < ApplicationController
  def index
    @store = Store.find(:all)
  end
end

查询#索引:

 = form_for(@store) do |f|                                                
    .field                                                                  
  %f.label>                                                         
  \%> br                                                              
  \#(f.check_box :active)                                                    
  %br/            

架构.rb:

     ActiveRecord::Schema.define(version: 0) do

      create_table "queries", :options => 'ENGINE=MyISAM', force: true do |t|
        t.string   "uuid",           limit: 250
        t.float    "lat",                        null: false
        t.float    "lng",                        null: false
        t.float    "execution_time",             null: false
        t.integer  "gps_accuracy",               null: false
        t.integer  "mode",           limit: 1,   null: false
        t.datetime "created_at",                 null: false
      end

      create_table "stores", :options => 'ENGINE=MyISAM', force: true do |t|
        t.string  "name",          limit: 250, default: "",   null: false
        t.string  "subname",       limit: 250, default: "",   null: false
        t.string  "phone",         limit: 250, default: "",   null: false
        t.string  "address",       limit: 250, default: "",   null: false
        t.string  "city",          limit: 100, default: "",   null: false
        t.string  "province",      limit: 50,  default: "",   null: false
        t.string  "postalCode",    limit: 25,  default: "",   null: false
        t.float   "lat",                                      null: false
        t.float   "lng",                                      null: false
      t.integer  "mode",           limit: 1,   null: false
    t.datetime "created_at",                 null: false
  end



     create_table "stores", :options => 'ENGINE=MyISAM', force: true do |t|
        t.string  "name",          limit: 250, default: "",   null: false
        t.string  "subname",       limit: 250, default: "",   null: false
        t.string  "phone",         limit: 250, default: "",   null: false
        t.string  "address",       limit: 250, default: "",   null: false
        t.string  "city",          limit: 100, default: "",   null: false
        t.string  "province",      limit: 50,  default: "",   null: false
        t.string  "postalCode",    limit: 25,  default: "",   null: false
        t.float   "lat",                                      null: false
        t.float   "lng",                                      null: false
        t.integer "store_type",    limit: 1
        t.boolean "active",                    default: true, null: false
      end

    end

商店.rb

class Store < ActiveRecord::Base                                                                                                                              

end
4

0 回答 0