"uninitialized constant ActionView::CompiledTemplates::GMap" error when using ym4r_gm plugin - ruby-on-rails-3

So I am somewhat new to Rails 3, and I am trying to integrate Google Maps with my Rails application.
I installed ym4r_gm from git://github.com/rorcraft.ym4r_gm.git, and I followed the tutorial on http://blog.brijeshshah.com/google-maps-in-ruby-on-rails/, and http://blog.brijeshshah.com/google-maps-in-rails-3/ .
After following the tutorial, I tried to run my application but I get an error that says "uninitialized constant ActionView::CompiledTemplates::GMap" regarding the "<%= raw Gmap.header %>" line. I have already installed the ym4r_gm-0.2.0 gem, and the ym4r-0.6.1 gem. Any suggestions on how to solve this problem?

Make sure that the gems you're trying to use in your Rails app are actually included in your Gemfile as well as being installed on your local machine.
Check out Ruby Gems for the exact line to include in your Gemfile. In this case, it's:
gem "ym4r_gm", "~> 0.2.0"
When you push your code to a production server like Heroku, the Gemfile tells Heroku which gems to pull down and install on the server. Also run this command when you're done.
bundle install

Related

I can't migrate the database of my Rails app on Heroku with sqlite

I'm following this tutorial on creating Ruby on Rail apps, and I've hit a roadblock. I am trying to migrate its database to Heroku, only to be told this:
c:\Sites\railsbridge\test_app>heroku run rails db:migrate
Running rails db:migrate on floating-ocean-40882... up, run.5709 (Free)
rails aborted!
Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not
loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the
minimum required by ActiveRecord).
I already have sqlite3 listed in my Gemfile, what am I doing wrong?
Heroku does not support sqlite and it is suggested to use postgresql for production
Please look into the following posts
Heroku deployment failed because of sqlite3 gem error
Deploying RoR app to Heroku with Sqlite3 fails
You can use Postgresql for production and the change should be simple. Just a change of gem in Gemfile and change in database.yml will do.
Heroku doesn't support SQLite it only support PostgresSQL here is full documentation for deployment on Heroku

Hard time installing Ruby on Rails because of different RVM versions

I'm following Michael Hartl's Ruby on Rails tutorial book and am trying to install rails. As the book says, I followed the instructions on InstallRails.com and got through most of it until I was told to run rails server and I kept getting the error that I didn't have railties gem not installed. I had initially ran sudo gem install rails and so I read that it didn't pick up railties for some reason but gem install rails did - so that fixed it. So now I was able to run rails server and the app was live.
I returned to the book and as the instructions say, I generated a new rails app, specifying the rails version (4.2.2). However, when I run rails again, I get errors. At this point, having tried a dozen different stackover flow solutions, I feel like I must have screwed up the files and maybe I should just get rid of rails completely and try installing from scratch.
Here's some information on where I'm currently at:
Faiques-MacBook-Pro:Desktop Faique$ rails -v
Rails 4.2.3
Faiques-MacBook-Pro:Desktop Faique$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Faiques-MacBook-Pro:Desktop Faique$ mkdir workspace
Faiques-MacBook-Pro:Desktop Faique$ cd workspace
Faiques-MacBook-Pro:workspace Faique$ rails _4.2.2_ new hello_app/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (= 4.2.2) - did find: [railties-4.2.3] (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ ubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
I'm not sure what other information I should provide.
This isn't an ideal solution but what I ended up doing was completely restoring my mac and then reinstalling rails but using rbenv instead as per a friend's recommendation. I am now set up with Rails.
I wanted to do a complete restore (deleting all my data) because I had tried so many stack overflow answers for different errors - including using sudo for certain commands - that I'm sure I had messed some important settings and would take a long time to figure out. I think this was surprisingly one of the more efficient solution, although far from ideal.

Error using mongrel 1.2.0.pre2 in rails 3 app on heroku

I am doing authentication from google and was getting request too long error so upon some research I added the mongrel gem. This fixed the request too long error on my local machine.
However, now when I push to heroku, I constantly get the error below
You have already activated daemons 1.1.0, but your Gemfile requires
daemons 1.0.10. Consider using bundle exec. (Gem::LoadError)
Gemfile:
gem 'pg'
gem 'compass', '>= 0.11.5'
gem 'fancy-buttons'
gem 'haml', '3.1'
gem "nifty-generators", :group=>:development
gem "bcrypt-ruby", :require => "bcrypt"
gem "jquery-rails"
gem "devise"
gem "omniauth"
gem 'oa-openid', :require => 'omniauth/openid'
gem 'mongrel', '1.2.0.pre2'
Perhaps taking mongrel out of the gemfile might fix issue at hand but then I would again have 'request too long' error when authenticating from google.
Is there a workaround to this? Should I be using a different version? If so...which?
I'v ran bundle exec locally even though heroku runs this on their end before deploying.
Try running bundle update daemons
Following advice I migrated ruby versions on the heroku stack: heroku stack:migrate bamboo-ree-1.8.7. I had to 'trick' git into pushing this change by committing a temporary file - no doubt there's a better way to do this!
It sounds like you have the problem only on your local machine, not on Heroku when it's deployed, correct?
Heroku uses Thin as webserver, and I highly recommend that locally, too.
Mongrel never really made the jump to Rails 3.x. And the default web server, Webrick, is not really industry strength, and I wouldn't be surprised if it had quirks like "request too long," etc.
Add the thin gem to your Gemfile.
The launch the server as follows:
rails s thin
And you should be cruising. Thin is also faster to start and handles multiple connections.
I think 3 problems here:
you're using Mongrel, as #Wolfram mentioned it's not a good idea. Add Thin to your Gemfile, bundle it, then use it with "rails s thin"
you made a little mod in Gem version probably, and it says you've activated a version then you've activated another one. Don't forget to bundle install then push it
Maybe it's better not only to update Bamboo stack but to use Cedar with "heroku create --stack cedar.

problem in installation on acts_as_taggable_on_steroids as a gem

hi i am trying to use acts_as_taggable_on_steroids in my rails3 project, but it gives me error.Once i installed it as plugin but no improvement.
please give me steps to install it as gem in rails3 ,and it's usage.
You have to use it as a plugin to work, at least that way worked for me in Rails 3. Download the plugin and put in in /vendor/plugins folder in your project.

How to install paper_trail plugin on Rails 3

I'm sure this is astonishingly straightforward, and I'm just inexperienced with Rails 3, but I can't figure out how to make it work.
I'm trying to install the paper_trail plugin into my Rails 3 app; but the instructions seem designed for Rails 2. I'm running under Windows, and don't have git available.
I've tried putting gem 'paper_trail' into my Gemfile and running bundle install, which picked up the gem correctly; but rails generate paper_trail (which I assume is the new form of script/generate paper_trail fails with Could not find generator paper_trail.
Can anyone give me some step-by-step instructions to get this working?
A little late to the party. I am writing this since I found the thread through Google. Here is how I got it to work with Rail 3.0.9. I was getting the same error with
bundle exec rails generate paper_trail
as well as
bundle exec rails g paper_trail
and
rails generate paper_trail
Turns out, you need to run
bundle exec rails generate paper_trail:install
that generated the migration file for me and a
bundle exec rake db:migrate
created the table.
As of 11 October, rails generate paper_trail works as you would expect.
I've managed to make this work by simply downloading the zipped code from github, unpacking it into vendor/plugins, installing the gem (through Gemfile and bundle install), and then copy-pasting the migration code in paper_trail's generator into a blank migration of the same name.