Using Foreman with Upstart & Capistrano

Using Foreman with Upstart & Capistrano

Foreman is a great tool for running multiple processes along side your rails project. Processes like Redis, Sidekiq, Faye or any other process that doesn’t run within Rails itself. Foreman runs in your development environment as well as your production environments. To use Foreman in production, you have to export it’s config file in one of the following formats: bluepill inittab launchd runit supervisord systemd upstart Since most of the servers we work on...

User does not respond to 'devise' method

I’ve recently went back to an old project and it seems to have stopped working giving me this error: ~/projectx/vendor/ruby/1.9.1/gems/devise-2.0.0/lib/devise/rails/routes.rb:391:in `raise_no_devise_method_error!': User does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's being loaded too late. To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb' or before your application...

Wicked_PDF working in Rails 3.1

I recently updated one of my apps to Rails 3.1 and found that my PDF generating tests were failing because they were unable to find the CSS or images to use in the PDF. So I started playing around, and here is what I got: In your app, add a new initializer (or edit your existing wicked_pdf.rb initializer) and put the following: As you can see in the code, I also replaced the background urls with correct references, this is assuming that you’re keeping your CSS...

MongoMapper – undefined method 'reflect_on_association'

Information Tidbit: If you’re using reflection_on_association with ActiveRecord and need to use it with MongoMapper, here is what you want to do: undefined method `reflect_on_association' for User:Class ActiveRecord: User.reflect_on_association(:posts).klass.new MongoMapper: User.associations[:posts].klass.new Mongoid: User.associations['posts'].klass.new notice the posts is a string, it will not work with a symbol UPDATE – (Apr 2011) Mongoid now follows...

Getting Paperclip to work with MongoMapper

Last night I was trying really hard to get MongoMapper to work with Paperclip via GridFS and failed. It seems right now Paperclip or even CarrierWave are not ready to be used with the latest MongoMapper drivers and GridFS (and I needed to use the latest drivers due to Scopify). After giving up using GridFS, I wanted to use Paperclip with MongoMapper with the normal file system and I found this article from Ben Curtis, however with the latest version of Paperclip...

MongoMapper logging to Rails log

I started playing around with MongoMapper for MongoDB and I have to say I’m loving it! Somehow it just feels so much easier to work with. However, I did have an issue with my code and needed to see whether or not MongoMapper was looking for account_id in my model. Since there is no sql to look at, I was looking for a way to see what MongoMapper was sending to MongoDB. Luckily the answer was very simple, in your connection string you just have to do this:...