Codebeerstartups

Codebeerstartups

Every Dog has one Blog


Featured

VIM ruby-on-rails

Ultimate VIM configuration for ruby on rails development

Posted on .

Thinking to setup Vim for Rails? Figuring out what are the best plugins? How to install them and lot of other things? Here is a quick setup for vim for ruby on rails development, having every plugin that you will ever need to use in ruby on rails development. An Ultimate VIM configuration for ruby on rails development.

Enjoy !!!

Featured

rubygems, development

Must have gems for development machine in ruby on rails

Posted on .

Rubygems are the best thing that happened in ruby on rails. So today here is my list of gems in development group that helps to make things faster or sometimes bring simplicity to the development process

gem "better_errors"
gem "binding_of_caller"
gem 'annotate'
gem 'bullet'
gem 'debugger'
gem 'flay'
gem 'hirb'
gem 'localtunnel'
gem 'lol_dba'
gem 'mailcatcher'
gem 'meta_request','0.2.1'
gem 'pry'
gem 'pry-doc'
gem 'quiet_assets'
gem 'rack-mini-profiler'
gem 'railroady'
gem 'rails-footnotes', '>= 3.7.5.rc4'
gem 'rails_best_practices'
gem 'reek'
gem 'request-log-analyzer'
gem 'smusher'
gem 'zeus' # don't add this in your gemfile.

What they do:

  • better_errors: Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware. If you would like to use Better Errors’ advanced features (REPL, local/instance variable inspection, pretty stack frame names), you need to add the binding_of_caller

Better errors Screenshot

Featured

heroku server

How to Set the default time zone for a Heroku app

Posted on .

For Rails apps running on Heroku, by default Time.now and some_time.localtime will display in UTC. If you’d like to assign a time zone to your app, you can set the TZ config variable to a time zone (which must be in the tz database timezone format).

Personally, I despise the tz database format, because it requires you to guess WHICH city is chosen to represent that time zone (for Pacific, it’s Los_Angeles, not Seattle, not San_Francisco). But that’s what Heroku uses, so to set your app to Pacific you simply run:

  heroku config:add TZ="America/Los_Angeles"

The allowed options are listed on the page linked above.

Featured

encryption-and-decryption

How to encyrpt and decrypt data in ruby on rails

Posted on .

AESCrypt is a simple gem to encryption and decryption in ruby on rails. From the readme file.

##Installation

Add this line to your application’s Gemfile:

gem 'aescrypt'
Featured

performance mysql active-record

How to optimize Active Record Queries

Posted on .

Using the select parameter in Active Record association, you can speed up your application about 50% and more.

##Before

class Patient < ActiveRecord::Base
  belongs_to :physician
end
class Physician < ActiveRecord::Base
  has_many :patients
end