ExceptionNotifier.notify_exception not working - ruby-on-rails

We are using this gem(https://github.com/smartinez87/exception_notification) with rails 3.2.11. We want to use following method "ExceptionNotifier.notify_exception(e)" from action of controller and from background process as mentioned on the wikie but we are getting following error
undefined method `notify_exception' for ExceptionNotifier:Class
We are installing 3.0.1 version of this gem.
gem "exception_notification", "~> 3.0.1"
Our rails version is 3.2.11 and ruby version is ruby 1.9.2p320.
Thanks

You're reading an API for notify_exception for a version that has yet to be released as a gem.
You can either point your Gemfile at the git repo
gem "exception_notification", git: "git://github.com/smartinez87/exception_notification.git"
or use the proper API call for 3.0.1
ExceptionNotifier::Notifier.exception_notification(request.env, exception,
:data => {:message => "was doing something wrong"}).deliver
The docs for 3.0.1 are here.

In your gem file just write this line
gem 'exception_notification' , '3.0.1'
and after that
bundle install
this works for me :)

Related

Ruby Version 2.3.3 Gemfile 2.3.0 (Sprockets Update)

I'm a newbie at Ruby on Rails. I'm trying to update the Gem file but it keeps giving me this error.
Your Ruby version is 2.3.3, but your Gemfile specified 2.3.0
The reason I'm trying to update the gem file is because of a security vulnerability .
check your gemfile, there will be
ruby '2.3.0'
you need to change it to
ruby '2.3.3'
more you can read here https://bundler.io/v1.12/gemfile_ruby.html and https://devcenter.heroku.com/articles/ruby-versions
Just change your ruby version at gem file to the version suggested by the error. Let's see if this works

Devise Invitable - Could not find generator 'devise_invitable:install'

I'm trying to setup scambra devise_invitable in my rails 5 project. After setting up the gem and bundle install, When I run the first command for the initial setup -
rails generate devise_invitable:install I get the following error.
Expected boolean default value for '--markerb'; got :erb (string)
Could not find generator 'devise_invitable:install'.
Maybe you meant 'devise:install', 'annotate:install' or 'responders:install'
This is my gemfile.
gem 'devise', github: 'plataformatec/devise', branch: 'master'
gem 'devise_invitable', '~> 1.7.2'
How do I fix this?
Okay. I restarted my laptop and it worked. Weird. Solution suggested from github found here. https://github.com/scambra/devise_invitable/issues/579
I tried with restarting and not worked in my case ruby 2.5.1 rails 5.2.3 dell xps ubuntu 18.04.
What worked is:
bundle exec gem install devise_invitable
then I saw that it installed version:
Successfully installed devise_invitable-2.0.1
Parsing documentation for devise_invitable-2.0.1
Done installing documentation for devise_invitable after 0 seconds
1 gem installed
so I updated Gemfile line to correct version:
gem 'devise_invitable', '~> 2.0.1'
and then run rails generate devise_invitable user successfully!

"Your Ruby version is 2.1.3, but your Gemfile specified 2.1.1" I receive this error even I use simple command like rails new

I have tried different answers from other posts but none is work. I cloned a project from github, and receive this error 'Your Ruby version is 2.1.3, but your Gemfile specified 2.1.1' while running bundle install/update.
It was originally specified ruby '2.1.1' in gemfile, but I still receiving the same error after removing ruby '2.1.1' from gemfile.
UPDATE:
Ok problem solved.
In Rails 2.x applications the version is also defined in config/environment.rb. Search for RAILS_GEM_VERSION and update the version number in that file too.

Rails 4 - Bundle error for obfuscate_id gem

I am trying to $bundle install the obfuscate_id gem into my Rails 4 application, but I am coming across an error:
It says it's dependent on Rails > 3.2.1, but I have Rails 4.0.2. Am I wrong in assuming this should work? Have I missed something?
The gem: https://github.com/namick/obfuscate_id
Thanks,
Michael.
I had the same issue. RubyGems doesn't seem to have the most recent version, so I installed the gem from Github, which resolved it. Put the following code in your file:
gem 'obfuscate_id', :git => 'https://github.com/namick/obfuscate_id.git'

Undefined method `name' for "SystemTimer":String

I am having a problem getting an old Ruby on Rails 2 app that hasn't worked in a year to work.
I'm trying to run rake test:functionals in the root of my project directory, but am getting undefined method 'name' for "SystemTimer":String.
I've pasted everything that I believe relevant to the problem here:
http://pastebin.com/NgBvystZ
Also, when I run rake itself, I get
Errors running test:units!
Not sure how to debug that.
I have copied and pasted everything that I think would be useful to understanding this problem. Your time is greatly appreciated. Thank you.
This is an incompatibility between versions of RubyGems greater than 1.3.7 and versions of Rails less than 2.3.12. There are a few ways to solve this.
Use Bundler
Bundler is easy to install, fixes this problem, and has a number of other advantages as well. I highly recommend it.
Upgrade to Rails 2.3.12 or higher
Rails 2.3.12 fixed compatibility issues with RubyGems 1.8.5 (see release report).
Downgrade to RubyGems 1.3.7
I would not recommended this unless you have no other choice. Use this command: gem update --system 1.3.7. Also, version 1.7.2 has partial compatibility (it will run, but freezing gems will fail and there are likely other issues).
I chanced upon this thread, because I got the following error when migrating some Radiant 0.9.1 installations to a new server:
undefined method `name' for "RedCloth":String
(3) The compromising solution: I haven't tested this personally, but I hear that rails 2.3 with bundler is compatible with the latest rubygems. If you're interested in this solution, see http://gembundler.com/rails23.html for getting bundler to work under rails 2.3.
For me solution 3 was the only option, since we had other apps needing the latest rubygems on the system.
Just install bundler and follow thes steps on this page:
http://gembundler.com/rails23.html
And put this in a file called "Gemfile" in the app root:
source :gemcutter
gem "radiant", "0.9.1"
gem "sanitize"
gem "fastercsv"
gem "rmagick"
gem "rack", "~> 1.1.0"
gem "rake", ">= 0.8.3"
gem "RedCloth", ">= 4.0.0"
gem "will_paginate", "~> 2.3.11"
gem "mysql"
This is just my example. Start with only the first 2 lines, run bundle update and reload the page to see what else you might be missing.
Thank you Ben!

Resources