If you gem install ym4r
but ym4r.rb and ym4r directory are installed in your ruby installed directory
C:\ruby\lib\ruby\gems\1.8\gems\ym4r-0.6.0\lib
Try to copy ym4r.rb and ym4r directory to your rails directory
where you install ym4r_gm plugin
C:\Documents and Settings\ming\RailsApplication4\vendor\plugins\ym4r_gm\lib
The error message when you run gwebmap_controller.rbg will be solved.
class GwebmapController < ApplicationController
require "ym4r/yahoo_maps/building_block/traffic"
include Ym4r::YahooMaps::BuildingBlock
def index
@map = GMap.new("map_div")
@map.control_init(:large_map => true, :map_type => true)
@map.center_zoom_init([38.134557, -95.537109],4)
@map.icon_global_init(GIcon.new(:image =>
"/images/icon_incident.png", :icon_size => GSize.new(15,15), :icon_anchor =>
GPoint.new (7,7), :info_windows_anchor => GPoint.new(9,2)), "incon_incident")
@map.icon_global_init(GIcon.new(:image =>
"/images/icon_construction.png", :icon_size => GSize.new(15,15), :icon_anchor =>
GPoint.new (7,7), :info_windows_anchor => GPoint.new(9,2)), "icon_construction")
end
end
The problem is rails can't find the plugin during require command.
The error message as bellow
MissingSourceFile in GwebmapController#index
no such file to load -- ym4r/yahoo_maps/building_block/traffic
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
ming
沒有留言:
張貼留言