Geokit Rails issue

48 views
Skip to first unread message

Jeremy Woertink

unread,
Feb 25, 2010, 5:01:38 PM2/25/10
to rubyonra...@googlegroups.com
I'm getting undefined local variable or method `acts_as_mappable'.

I only have 1 model in my app right now. I have tried several methods of
installation.

1. Tried using bundler adding gem "geokit", "1.5.0" to the Gemfile and
bundle install and bundle pack.

2. Tried Rails::Initializer.run do |config|config.gem "geokit" end with
rake gems:install

3. tried ./script/plugin install git://github.com/andre/geokit-rails.git

none of these work for me. I get the same error.

Here is my model.

require 'geokit'
require 'vendor/plugins/geokit-rails/init.rb'
class Listing < ActiveRecord::Base
acts_as_mappable
end

got my config/preinitializer.rb file

Any ideas?

~Jeremy Woertink
--
Posted via http://www.ruby-forum.com/.

Craig White

unread,
Feb 25, 2010, 5:12:09 PM2/25/10
to rubyonra...@googlegroups.com
----
It doesn't stick out in my mind so I have to believe that somewhere in
their documentation, you just add to config/environment.rb (inside the
initializer loop)

config.gem "geokit"

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Jeremy Woertink

unread,
Feb 25, 2010, 6:10:10 PM2/25/10
to rubyonra...@googlegroups.com


yeah, I tried that, and it didn't work. (see method #2). I've already
done a google search for that error, and a couple blogs come up that
show methods for fixing it. I've tried their methods, but it hasn't
worked for me.

Craig White

unread,
Feb 25, 2010, 6:37:11 PM2/25/10
to rubyonra...@googlegroups.com
On Fri, 2010-02-26 at 00:10 +0100, Jeremy Woertink wrote:
> Craig White wrote:
> > On Thu, 2010-02-25 at 23:01 +0100, Jeremy Woertink wrote:
> >>
> >> end
> >>
> >> got my config/preinitializer.rb file
> >>
> >> Any ideas?
> > ----
> > It doesn't stick out in my mind so I have to believe that somewhere in
> > their documentation, you just add to config/environment.rb (inside the
> > initializer loop)
> >
> > config.gem "geokit"
> >
> > Craig
> >
> yeah, I tried that, and it didn't work. (see method #2). I've already
> done a google search for that error, and a couple blogs come up that
> show methods for fixing it. I've tried their methods, but it hasn't
> worked for me.
----
umm... of course it works - I have a fully functional web site working
using exactly that setup. That also is the way to tell rails to use an
installed gem in the application.

Craig White

unread,
Feb 25, 2010, 6:41:23 PM2/25/10
to rubyonra...@googlegroups.com
On Fri, 2010-02-26 at 00:10 +0100, Jeremy Woertink wrote:
> Craig White wrote:
> > On Thu, 2010-02-25 at 23:01 +0100, Jeremy Woertink wrote:
> >>
> >> end
> >>
> >> got my config/preinitializer.rb file
> >>
> >> Any ideas?
> > ----
> > It doesn't stick out in my mind so I have to believe that somewhere in
> > their documentation, you just add to config/environment.rb (inside the
> > initializer loop)
> >
> > config.gem "geokit"
> >

>

> yeah, I tried that, and it didn't work. (see method #2). I've already
> done a google search for that error, and a couple blogs come up that
> show methods for fixing it. I've tried their methods, but it hasn't
> worked for me.

----
Get rid of these...

require 'geokit'
require 'vendor/plugins/geokit-rails/init.rb'

config/preinitializer.rb file

Jeremy Woertink

unread,
Feb 25, 2010, 6:48:28 PM2/25/10
to rubyonra...@googlegroups.com


yeah, I got all the other gems working fine. (rails, mysql, paperclip,
will_paginate, clearance). Just for some reason, I can't get this one to
work. Actually, I take that back. If I hop into console and require
"geokit", then I can use the API directly. The only thing I can't get to
work is acts_as_mappable. It just keeps saying that it's undefined. My
model is Listing, so when I just hop into console and type "Listing" it
throws the error, even if I require 'geokit' first.

Craig White

unread,
Feb 25, 2010, 7:15:33 PM2/25/10
to rubyonra...@googlegroups.com
----
I don't use the plugin, don't use any 'require' anything just...

config/environment.rb

config.gem "geokit"
'
and in my model...

acts_as_mappable

that's it - nothing more... restart the web server, open a console -
done.

Jeremy Woertink

unread,
Feb 25, 2010, 7:21:57 PM2/25/10
to rubyonra...@googlegroups.com
Craig White wrote:
> On Fri, 2010-02-26 at 00:48 +0100, Jeremy Woertink wrote:
>> >> done a google search for that error, and a couple blogs come up that
>> > --

>> model is Listing, so when I just hop into console and type "Listing" it
>> throws the error, even if I require 'geokit' first.
> ----
> I don't use the plugin, don't use any 'require' anything just...
>
> config/environment.rb
>
> config.gem "geokit"
> '
> and in my model...
>
> acts_as_mappable
>
> that's it - nothing more... restart the web server, open a console -
> done.
>
> Craig
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

hmm, yeah. It's the weirdest thing. I started a fresh app and tried just
that, and it was a no go. I still get undefined method
acts_as_mappable.... I'm not sure what's going on, but that's for the
help :)

using:
Ruby 1.8.7
Rails 2.3.5
Geokit 1.5.0
OSX 10.5.8

Corey W.

unread,
Feb 23, 2011, 2:20:27 PM2/23/11
to rubyonra...@googlegroups.com
Jeremy Woertink wrote in post #892229:

> hmm, yeah. It's the weirdest thing. I started a fresh app and tried just
> that, and it was a no go. I still get undefined method
> acts_as_mappable.... I'm not sure what's going on, but that's for the
> help :)
>
> using:
> Ruby 1.8.7
> Rails 2.3.5
> Geokit 1.5.0
> OSX 10.5.8

Did you ever get anywhere on this issue? Were you using Bundler at the
time? I just ran into it while setting up an existing application to use
Bundler. Upon disabling Bundler, everything works as before, so I'm
certain it's a Bundler bug... Not sure where to start on it.

Corey W.

unread,
Feb 23, 2011, 3:19:45 PM2/23/11
to rubyonra...@googlegroups.com
Corey W. wrote in post #983408:

Solved it! First, make sure you don't have the geokit-rails plugin
installed. It just confuses Bundler and Rails. Then make sure you
specify in your Gemfile BOTH the geokit gem AND the geokit-rails gem,
something like this:

gem 'geokit', '>= 1.5.0'
gem 'geokit-rails', '1.1.4'

If you're on Rails 3, that should do it. If you're on Rails 2 like me,
you'll need to make sure you follow the instructions on the Bundler
website: http://gembundler.com/rails23.html

Works beautifully for me!

Reply all
Reply to author
Forward
0 new messages