Dragonfly question - ruby-on-rails

I tried switching from gem rails 3.0.0.rc to rails 3.0.0 in my Gemfile recently and when doing so I got a problem with Dragonfly when starting the server. The error message says:
/Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant Dragonfly::Config::HerokuRailsImages (NameError)
from /Users/erikostling/Spatziba/config/initializers/dragonfly.rb:4
Switching back to RC doesn't help. Does anyone have an idea on what is wrong?
My dragonfly.rb looks like this:
require "dragonfly"
app = Dragonfly::App[:images]
app.configure_with(Dragonfly::Config::HerokuRailsImages, "static.my-app-domain.com")
app.parameters.default_format = :jpg
Dragonfly.active_record_macro(:image, app)
Any help would be greatly appreciated!
E

Make sure to follow this Rails 3 installation instructions.

Related

ruby gem issue uninitialized constant

Ok I'm not a pro at creating gems, but I tried my best and created this gem https://rubygems.org/gems/webpack_native/versions/0.2.0
This gem has generators and if I use it from the local folder (meaning the gem folder is in my computer) it works fine, if I type rails g in terminal it shows me the generators including my gem's generators
But using it from rubygems always give me an error uninitialized constant WebpackNative:
/home/mody/.rvm/gems/ruby-2.7.0#myapp/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant WebpackNative (NameError)
any thoughts on this?
I'm not sure how this happen but I get it to work after I installed devise gem and run
rails g
the output of the available generators shows up including my gem, and the generator itself is working.

Gem NameError when called from other gem

I'm trying to get PartyFoul set up on a Rails project I collaborate on and am running into a weird issue when I run the install generator.
~/.rvm/gems/.../party_foul-1.5.4/lib/generators/party_foul/install_generator.rb:21:in `rescue in create_initializer_file': uninitialized constant PartyFoul::InstallGenerator::Octokit (NameError)
from ~/.rvm/gems/.../gems/party_foul-1.5.4/lib/generators/party_foul/install_generator.rb:17:in `create_initializer_file'
The script is having trouble finding the Octokit gem so if I put require 'octokit' at the top of install_generator.rb, everything is happy. The weird part is that I can't replicate this issue on a clean Rails 4 or Rails 3.2 project that simply has PartyFoul installed, so it must be specific to this project, and while I can get the configuration file set up manually, I'd like to figure out what root cause of this problem is.
Any help would be much appreciated, thanks!
I just figured it out, the PartyFoul gem was in the :production group so I'm assuming that Rails was somehow not loading it properly. I replicated the NameError in the clean Rails project after moving the gem to :production, so that seems to be the difference. I'm not sure what the root cause is, any enlightenment would still be appreciated :-).

Rails gcal4ruby gem uninitialized

I'm trying to create a Ruby on Rails web app that will sync with google calendar. I tried to use omniauth but it didn't work for me.
I found a rails gem that should do the job for me: gcal4ruby
But for now it isn't working.
I use the code:
#serv = Service.new
#serv.authenticate 'account#gmail.com', 'pass'
and got an error:
uninitialized constant UsersController::Service
In my gemfile using:
gem 'gcal4ruby', '0.5.5'
Gem was installed successfully after bundle install.
By trying to use similar gems I got the same error so I suppose that issue is something else.
I tried to use require "gcal4ruby" in my code and got error:
cannot load such file -- gcal4ruby
I'm using ruby 1.9.3 and rails 4.0.2.
Thanks for help.
Try:
require 'gcal4ruby'
include GCal4Ruby
Which mixes-in the Service class.
Note, that GCal4Ruby uses version 2 of the google calendar api which is deprecated and will not work after November-17th 2014.
Here is a great tutorial on getting a rails app working using omniauth.

execption notifier gem issue

I installed exception_notifier gem following this http://railscasts.com/episodes/104-exception-notifications-revised. But when running rails s, I got this
/home/ruby-2.0.0-p195/gems/actionpack-3.2.13/lib/action_dispatch/middleware/stack.rb:43:in `build': undefined method `new' for ExceptionNotifier:Module (NoMethodError)
So I tried to Google this problem, and I found that I could use in my production.rb file this config.middleware.use ExceptionNotifier::Rack... insted of this config.middleware.use ExceptionNotifier...
But then I got this message:
uninitialized constant ExceptionNotifier::Rack (NameError)
How should I handle this gem installation ?
If you follow the link https://github.com/smartinez87/exception_notification indicated by #pdobb, you 'll find you have to use
ExceptionNotification::Rack
instead of
ExceptionNotifier::Rack
It's ExceptionNotification::Rack. ExceptionNotifier was for the pre-4.0 versions. See the Getting Started info here: https://github.com/smartinez87/exception_notification for the specifics.

`method_missing': undefined local variable or method `authentication_keys' error when installing devise

I'm trying to get Devise up and running. I'm using devise 1.0.10 and rails 2.3.8, on an otherwise pretty clean hostingrails install.
When I run ruby script/generate devise_install
I get the following error message. Has anyone seen this before. Any ideas how to proceed with the install? I searched around and hit a wall.
Thanks, Tim
ruby script/generate devise_install
/home/p7017r10/appname/config/environment.rb:4: warning: already initialized constant RAILS_ENV
/usr/local/rvm/gems/ruby-1.8.6-p369/gems/activerecord-2.3.8/lib/active_record/base.rb:1994:in method_missing': undefined local variable or methodauthentication_keys' for # (NameError)
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models/validatable.rb:18:in included'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models/validatable.rb:16:inclass_eval'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models/validatable.rb:16:in included'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models.rb:66:ininclude'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models.rb:66:in devise'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models.rb:65:ineach'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/models.rb:65:in devise'
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/devise-1.0.5/lib/devise/orm/active_record.rb:24:inincluded_modules_hook'
... 37 levels...
from /usr/local/rvm/gems/ruby-1.8.6-p369/gems/rails-2.3.8/lib/commands/generate.rb:1
from /usr/local/rvm/rubies/ruby-1.8.6-p369/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require'
from /usr/local/rvm/rubies/ruby-1.8.6-p369/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/generate:3
check the devise group on google groups
http://groups.google.com/group/plataformatec-devise
that's the better forum to ask this question
I guess you should look into initializers/devise.rb. There are some instructions on setting those keys. Plus, please refer to http://asciicasts.com/episodes/210-customizing-devise, http://blog.plataformatec.com.br/tag/subdomain/.
I didn't use devise with RoR 2.3.x, only with 3.0.x. That could be the difference.
Hope that helps. Let us know :)

Resources