Rails

Decoding the Session Cookie: Rails 4.2

How to view the contents of your Rails session cookie, the Rails 4.2 version.

0 Comments
Read more
Elasticsearch and Rails: analyzer [searchkick_search] not found

Elasticsearch will create indices for you on-the-fly. This can be a problem when you want your index to have additional analyzers.

0 Comments
Read more
New gem: simple_bootstrap_form

Simple Form still doesn't support Bootstrap 3, seven months after they started discussing it.

0 Comments
Read more
Zeus and db:test:prepare

On some Rails projects that use PostgreSQL as their database, you may find running Zeus will stop you doing rake db:test:prepare. Here's now to make them play nice together.

0 Comments
Read more
How Rails Class Reloading Works

In development mode, Rails will reload all classes you use for each request, allowing you to rapidly modify and test code without restarting the server. Recently, while debugging a gem I was developing, I had cause to figure out how this all works.

0 Comments
Read more
Decoding the Session Cookie: Rails 2.x
0 Comments
Read more
Decoding the Session Cookie: Rails 4.1
0 Comments
Read more
ActiveRecord: Validation of Associations

If you have two models associated in some way, it is usual to add a validates_presence_of validator to ensure that the models are connected before saving. However, be aware that there are two ways of doing this with different performance ramifications.

0 Comments
Read more
'display' is a Reserved Action in Rails

Although it is not currently mentioned in the reserved words page (http://wiki.rubyonrails.org/rails/pages/ReservedWords"), "display" is a reserved word as far as controller actions are concerned.  Try it.  With Rails 2.1.1 you can have an action called "displa" but not "display".  Ruby Object#display can be readily overwritten, but I expect Rails is being overly zealous in it's extermination of the default object environment.

0 Comments
Testing named routes in the rails console

Just found out how to test named routes in the Rails console here:

0 Comments
Read more