Gem not found after migration 2 -> 3 - ruby-on-rails-3

I migrated a rails 2 project to rails 3.
I use several gems, and i migrated it to Gem file, installing them with bundle.
But i get the following error:
NameError (undefined local variable or method `acts_as_rateable' for #<Class:0x10322fc00>):
But the gem is correctly installed.
Any hint? I am struggling with this...

Related

Session creation causes error with Rails engine generated under Rails 4.1

There are Rails 4.1 and 3.2.12 installed on our system (Windows). When generating Rails engine with:
rails plugin new engine --T --mountable --dummy-path=spec/dummy
The engine is generated with Rails 4 by default. Under spec/dummy/config, we notice that it is:
Rails.application.configure do
Instead of in Rails 3.2.12 engine:
Dummy::Application.configure do
It seems that the Dummy is replaced with Rails in Rails 4 engine. Then we changed the gemspec to rails, '~> 3.2.11' and bundle install and replaced Rails.application with Dummy::Application in dummy/config (now it is rails 3.2.12 in gemfile.lock). However there is error when creating sessions under spec/dummy:
rake db:sessions:create
The error is undefined 'configure' or undefined 'migration_error=' even after replacing Rails.application with Dummy::Application. There is not much info about what's new in Rails 4 engine. How to fix this problem?

Devise_invitable in rails 4?

I am trying to use devise_invitable(0.1.3) in my application and my application already uses devise(3.1.0). I specified the devise_invitable in my gem file and run bundle install it installed successfully but when i run any command it gives the following error:
Error:
uninitialized constant DeviseMailer (NameError)
Can anyone tell what i am doing wrong?
Any help would be appreciated.
Thank You
Per the devise_invitable README, you need to be using the version straight from github if you are on Rails 4:
gem 'devise_invitable', :github => 'scambra/devise_invitable'

undefined method `acts_as_mappable' trying to use geokit

I am trying to use geokit but I get the following message:
undefined method `acts_as_mappable'
I have tried the following solutions but nothing has worked so far:
Rails 3.1.0, geokit, with error acts_as_mappable
I am using rails 3.0.1 and ruby 1.9.2
I have followed the instructions here https://github.com/jlecour/geokit-rails3 but its not working
This is my model:
class Event < ActiveRecord::Base
acts_as_mappable :default_units => :kms,
:default_formula => :flat
end
and I have this in my gemfile
gem 'geokit-rails3'
I also have the folder vendor, inside I have a geokit-rails3 folder with the files, one of them named acts_as_mappable. I have tried adding require 'geokit-rails3' in the top of my model but it says no file to load.
I tried both, installing it as a plugin:
rails plugin install git://github.com/jlecour/geokit-rails3.git
and also by doing gem install (and it is shown when I list all the gems installed)
Any help is greatly appreciated.
The problem was solved by reinstalling rails with:
sudo apt-get install rails rails-doc rails-ruby1.8

no such file to load -- google_chart using gem gchartrb

I am trying to use the gem gchartrb to create some graphs/charts in my RoR application.
I have looked into several tutorial and all say the same thing, that I have to add
require 'google_chart'
But I am getting the message:
no such file to load -- google_chart
I have the require inside my controller, I have confirmed that the gem is installed.
I am using Rails 3.
Also, I have tried adding config.gem 'gchartrb', :lib => 'google_chart' in my environment.rb as suggested here but nothing changed
Thanks for your help
EDIT:
I have also tried with the gem googlecharts, what I have in my Gemfile is:
gem "googlecharts", :require => "gchart"
but I get no such file to load -- gchart when I try to load the view.
I am not sure, it is required now or not. But it worked for me in Rails 3 as well. I am using Rails 3.0.10. I added below 2 lines and it worked for me.
1) gem 'gchartrb' in Gemfile
2) require 'google_chart' in config/boot.rb
Hope it helps!
config.gem is for rails 2.3.X.
For rails 3, you will need to add the gem to your Gemfile and run gem bundle
You may also need to check that the google_charts gem actually supports Rails 3...
Given that the latest code update seems to have been in 2008 - that might not actually be likely. :(
You can try it anyway and see...

Rails 3 Initializers: No such file to load

I am trying to use the Sunlight API gem with a Rails project. I have installed the gem and can successfully use it from irb.
However, when I put the require statement (require 'sunlight') in sunlight.rb in config/initializers, I get the following error:
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require': no such file to load -- sunlight (LoadError)
I checked the permissions on the gems directory, and it is world readable/executable.
Here is the code from sunlight.rb:
require 'rubygems'
require 'sunlight'
Sunlight::Base.api_key = 'bb7b775755054c54aa9715d202f6785c'
Can anyone tell me how to fix this? TIA!
Is sunlight listed in your Gemfile? Rails3 uses Bundler to manage Gem installations.