Tag Archives: rails

Does Rails Scale?

Does Rails Scale?

Using ActionMailer::Preview with Devise mailers in Rails 4.1

ActionMailer::Preview is pretty awesome and newly introduced in Rails 4.1+ It allows you to preview formatting of emails from within the browser without having to send emails just to be able to preview them in the email client. This substantially reduces the duration of each development cycle between coding and testing a modification. If you […]

Log to your JavaScript Console from Ruby

You can log to your JavaScript console from Ruby with https://github.com/ConradIrwin/console.log What problems has it solved for you?

What to set passenger_root and passenger_ruby paths when using RVM or rbenv

If you’re using Rails, Nginx, Passenger and RVM or rbenv and wondering what to set the passenger_root and passenger_ruby paths to in nginx.conf, here’s how to get them. Keep in mind, you’ll have to do this by reconfiguring Nginx if you switch from RVM to rbenv or vice-versa. First you must install the passenger gem […]

Logstash Rails – Collecting / Aggregating Rails Log Stacktrace with Logstash shipper agent

How to prepare and aggregate Rails logs for Logstash: Before tagging your stacktrace events from your Rails production.log, for example, you will want to write a multiline filter in Logstash which will include each stacktrace event as a separate entry. Each section of your Rails log starts with the word “Processing” and ends with two […]

Bash Terminal Customizations for RVM and Git with git-completion.sh

In process of customizing my bash terminal prompt in my ~/.bash_profile, I thought it would be great to show which RVM and Git branch I was on. You can make yours look similar to this: Screenshot of what Navid’s Bash Terminal Looks Like The solution is to use git-completion.sh. You can get it via git: […]

Clearing All Rails Log Files with Rake Task

In order to clear all of your Rails log files development.log, production.log, server.log and test.log with a rake task, type: This is mainly useful while under development. Be careful with this as it will clear out your production.log file as well!

Building Custom XML Responses in Rails

Assume you have a CitiesController with just one action capital_city, which doesn’t need any of the RESTful actions. I set up a custom route for this one action. The capital_city action returns the xml like the following, for example: Here is what the entry in the routes.rb file looks like: Your controller may look something […]

Bundle Install – missing mysql.h

If you’re seeing the following error: The way I was able to resolve it was to follow Boonedocks.net, since I’m also using MAMP for its MySQL Database instance. The only difference is that I already had MAMP 1.9.4 installed and so I had to download the MAMP_components_1.9.dmg which contains the mysql-5.1.44 source code. MAMP 1.9.4 […]

Wym_Editor (WYSIWYM) Plugin for Rails

The wym_editor (WYSIWYM – “What you see is what you mean”) plugin is pretty cool. It allows you to define which form fields you want to offer WYSIWYM editing functionality. This makes it easier for you to edit fields and give them styles. It also allows you to see the HTML source view while you […]