Ruby on Rails Database Indexes
Contact me at LinkedIn  RailsZilla at Facebook  RailsZilla at twitter   google +1  Contact me at Xing  connect me at github

Ruby on Rails Database Indexes

Posted in Rails

Handy hint for better database performance in Ruby on Rails: Always add DB index in your Migration! By default, rails does not add indexes automatically for foreign key, you should add indexes by yourself. If you want to speed up your performance, I suggest to add an index for – foreign key – columns that […]

Tags: , , , , , ,

Why the Rails default_scope is a bad thing

Posted in Rails

Activerecord provides default_scope to set a default scope for all operations on the model. I was never a friend of using default_scope, even when many friends used it in their projects. At the first look, it looks convenient but will lead to a headache very soon. We should avoid using it and here is why: […]

Tags: ,

Ruby on Rails Security Checklist

Posted in Rails

When ever we create a project, the same issue is our pain in the ass … I talk about Security which is somehow dull and seems to be boring. I have done a simple checklist for a quick review of your code, which is divided in three simple steps: model, view and of course controller. […]

Tags: , , ,

Rails Security – Clickjacking

Posted in Rails

Note: This exploit is fixed in Rails 4 Our exploit today is clickjacking which is also called “UI redress attacks”. With clickjacking you can take an unexpected action for your victim by rendering the target site in an invisible frame. As an example, an attacker may trick users into taking undesired actions like making a […]

Tags: , , , ,

Security issue – symbol DoS vulnerability in ActiveRecord

Posted in Rails

There is a symbol DoS vulnerability in Active Record. When a hash is provided as the find value for a query, the keys of the hash may be converted to symbols. Have a look at this example: 1User.where(:name => { ‘foo’ => ‘bar’ }) When you write this small piece of code, the string ‘foo’ […]

Tags: , , ,

Ruby on Rails precompile assets errors

Posted in Rails

If you are upgrading to Rails 3.1.0 from Rails 3.1.0.rc6, you could get an error message like this: 1234567$ RAILS_ENV=production RAILS_GROUPS=assets rake assets:clean tmp:clear assets:precompile rake aborted! mypicture.gif is not precompiled (in app/assets/stylesheets/mystyle.css.scss) Tasks: TOP => assets:precompile (See full trace by running task with –trace) while running the command: 1assets:precompile All you have to do […]

Tags: , , , ,

Ruby on Rails performance issues

Posted in coffee break, Rails, Ruby

I was thinking several times about this message and discussed it with some friends: http://engineering.twitter.com/2011/04/twitter-search-is-now-3x-faster_1656.html Twitter started to rewrite their search engine using Lucene instead of MySQL and replaced the Ruby-on-Rails front-end by a Java server, which is supposedly to be faster … ?!? As you can read in the article: “Over time, we had […]

Tags: , , , , , ,

Rails deployment at Heroku

Posted in Rails

This time I show you how to deploy your application at Heroku. Heroku is a cloud platform as a service (PaaS) supporting several programming languages. Heroku claims to offer the most NoSQL add-on solutions in the market today and that it introduced the ‘polyglot platform’. Let’s start: After signing up for a Heroku account, you […]

Tags: , , , , , ,

mongoDB connection problem

Posted in coffee break, Rails, Ruby

if mongo won’t run, try 1234sudo rm /var/lib/mongodb/mongod.lock sudo -u mongodb mongod -f /etc/mongodb.conf –repair sudo start mongodb sudo status mongodb should fix your problems ;-)

Tags: , , , ,

rails 3.1 vs Symfony2 – my first comparison

Posted in coffee break, Rails

I wish all a good start in 2012! In this new year, I have work-related to do with the Symfony2 Framework. When you ask aunt google, you will allways see forum-postings and search requests like symfony vs rails django vs rails vs symfony vs PHPcake vs your_mom_or_whatever Because I am new to Symfony, my differentiation […]

Tags: , , , , ,

Copyright © 2011-2017  - RailsZilla – Ruby on Rails tutorials, tips and tricks All rights reserved. | Imprint | Privacy