Results 1 to 3 of 3

Thread: RoR + mysql ..

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    , ... Shaft's Avatar
    Join Date: Feb:2007
    Location:
    Posts: 382

    RoR + mysql ..

    ,

    ... googlemaps rails. locations - "":



    , mysql-. googlemaps - id, location, lat, lng.

    lat lng GPS (, the best , ...).

    , , ...

    , , ... ...


    Code:
    cat controllers/gmapscontroller.rb
    ----------------------------------------------------------------------------------
    
    require 'rubygems'
    require 'google_geocode'
    
    class GmapsController < ApplicationController
    
    include Geokit::Geocoders
    
     def index
            lat = Googlemaps_dev.find(:all, :select => "lat")
            lng = Googlemaps_dev.find(:all, :select => "lng")
    
          @map = GMap.new("map_div")
          @map.control_init(:large_map => true,:map_type => true)
          @map.center_zoom_init([lat, lng],7)
          @map.overlay_init(GMarker.new([lat, lng],:title => "Test Location", :info_window => "Test Location 2"))
     end
    
    end
    mappable.

    Code:
    class Googlemaps_dev < ActiveRecord::Base
    acts_as_mappable
    end
    - , ...


    , :

    Code:
    +----+----------------+---------+---------+
    | id | location       | lat     | lng     |
    +----+----------------+---------+---------+
    |  1 | Home |  42.7046  | 23.3276 |
    +----+----------------+---------+---------+
    1 row in set (0.01 sec)
    , , lng lat ... !

    , ... ?
    Code:
    >> lat = Googlemaps_dev.find(:all, :select => "lat")
    => [#<Googlemaps_dev lat: 42.7046>]

    !

    ' ... ! - ... !

  2. #2
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    , CMS ( 2 ) Flash API- Google. MySQL, XML AS. PM, .

  3. #3
    , ... Shaft's Avatar
    Join Date: Feb:2007
    Location:
    Posts: 382

    Problem solved :)

    , , , ...

    ' ... ! - ... !

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |