I am using whenever gem for handling cron job in a Ruby on Rails application. It’s fantastic because of it’s very easy DSL to create tasks and schedule it. It will do all the dirty works to update crontab and run your task periodically as per your definition.
However, I ran into one problem that upon each deploy, whenever was creating a separate item in crontab. So when I’ve tried to check cron jobs (crontab -e), I see there are so many tasks.
It was doing this because I didn’t have :application param set in my capistrano settings (deploy.rb). Whenever depends on this name to match the existing names and update it. So all you need is to set application to your deploy.rb file.
set :application, 'your-fancy-app'
That should solve the problem. However, you need to manually cleanup current cronjob as it won’t update the current mess.
I was getting this error when the ruby version is updated to 1.9.3-p484. When you’re using RVM, the solution is quite simple. Install the gem with the following command:
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=\$rvm_path/src/ruby-1.9.3-p484
If you need to install different version of debugger-linecache change 1.1.2 with appropriate version. If the you’re using different ruby version, change ruby-1.9.3-p484 to appropriate value.
The title is a bit skeptical. Isn’t it? But trust me, it’s true. You can implement solr power searching in your Ruby on Rails application without knowing Solr. Yes, you off course know about Solr. What you don’t know is how to make it work for you. Let’s check how can you power your application with Solr using Sunspot gem.
What is Sunspot?
Sunspot is a Ruby library for expressive, powerful interaction with the Solr search engine. Sunspot is built on top of the RSolr library, which provides a low-level interface for Solr interaction; Sunspot provides a simple, intuitive, expressive DSL backed by powerful features for indexing objects and searching for them.
Using the sunspots DSL, you can easily implement solr powered searching. Its drop-in support with Rails models let you power your site with a few lines of codes.
Add the following line in your Bundle file.
Then run ‘bundle install’. Continue reading →
I was trying to retrieve metadata from audio formats. For this I wanted to use taglib-ruby gem. While running command (gem install taglib-ruby) I was getting
ERROR: Error installing taglib-ruby:
ERROR: Failed to build gem native extension.
It is because I need to install taglib before I install taglib-ruby gem. However, this was not as easy as I thought it would be. In CentOS I could not compile the version 1.8. After trying different things, I tried and could compile it’s 1.7 version.
Continue reading →
Today I’ve decided to write something about the Ruby Gems that I used. So I’ve started this series (Ruby Gems). This is the first post of the series. I will try to write regularly.
When I was working on my pet project MovieMates, I needed to implement a friend relationship. Initially, I was going to do it myself. However, later I thought I should, at least, google a bit to check if there is already some similar solutions. Then I found Amistad.
The current version of Amistad supports ActiveRecord 3.0.x, Mongoid 3.0.x and MongoMapper 0.12.0.
Add following line to your Gemfile
Continue reading →