apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

delegate method fails when delayed_job and delayed_job_web are installed #298

Closed dvictory closed 10 years ago

dvictory commented 11 years ago

These two gems (gem 'delayed_job_active_record' and gem "delayed_job_web") when coupled with this gem cause it to fail. It seems these gems install sinatra and sinatra overrides the delegate method(base.rb) which is used in js_builder.rb. I didn't get much further but, replacing the delegate call with to accessor functions for options and data fixes the issue. Not sure why this is happening, but hopefully someone will save some time knowing how to resolve this issue.

I replaced: delegate :options, :data, :to => :@element_info

with:

def options @element_info.options

end

def data @element_info.data end

to get it to work.

apneadiving commented 11 years ago

This should correct the bug, please confirm https://github.com/apneadiving/Google-Maps-for-Rails/commit/3ff52deb455e1077c9f60660486fcd38f78e737f

dvictory commented 11 years ago

Still getting an error. Here is the top part of my stack trace, looks like sinatra is still causing an issue:

sinatra (1.3.3) lib/sinatra/base.rb:1231:in `options'
sinatra (1.3.3) lib/sinatra/base.rb:1660:in `block (2 levels) in delegate'
/Volumes/OSX_Lion_Data/Users/victory/.rvm/gems/ruby-1.9.3-p327/bundler/gems/Google-Maps-for-Rails-3ff52deb455e/lib/gmaps4rails/js_builder.rb:124:in `set_configuration_variables'
apneadiving commented 10 years ago

crazy, I ended up dropping ruby code from the gem and I now only fully focus on map display. Leads to a far flexier api and neater code.