If you have jQuery code like this: if (condition) { $element.show(); } else { $element.hide(); } ... you can shorten this to: $element.toggle(condition);

When dealing with AR scopes, you can remove conditions, order, etc by using the unscope method. It is available on...

You can say this in Javascript: $.fn.jquery => "1.11.1"

makandra dev

Redactor is yet another WYSIWYG editor. It definitely has its weak points, but I want to point out that it...

postgresql.org

PostgreSQL's array data type is pretty useful, but manipulating values of arrays can be awkward because of its syntax...

Rails 4 introduced raising an error on pending migrations. This is most annoying when you are crafting a migration but...

speakerdeck.com

Web fonts are great. They are also be really bad for front-end performance because they block rendering. You may...

Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...

github.com

Rails 5 will introduce ActiveRecord::Relation#or. On Rails 4 and 3.2 you can use the activerecord_any_of gem...

postgresonline.com

When working with PostgreSQL, you can use pgAdmin as a GUI. While you can do most things just like on...

blog.intercom.io

A fantastic guide for a dilemma facing any web-based product. Here’s a simple set of Yes/No questions that...

To safely transport an arbitrary string within a URL, you need to percent-encode characters that have a particular meaning...

As the web is being used for more and more tasks, expectations rise. Not only should web pages offer rich...

We organize our daily work with issues in our Linear workspace. Issue format A good issue needs to be precise...

andismith.com

If you need to upgrade code that uses the old jQuery methods bind, delegate, live, unbind and die, the attached...

It smells. Rethink your code design. Code example with makandra/has_defaults: class Post < ActiveRecord::Base has_defaults tags: [] # field in db...

hacks.mozilla.org

Unfortunately, Web APIs haven’t provided the functionality to copy text to the clipboard through JavaScript, which is why visiting...

You may encounter problems with passenger starting an application with an updated rails. If you find an error like this...

If you need a postgresql extension for your database it isn't a good idea to give your applications database...

As you most likely know validates_uniqness_of :foreign_id does not allow nil values by default.

Use form models to handle this problem Or soften the validation to validates_presence_of :parent

Use base_class. This traverses up the hierarchy until it encounters either a class inheriting from ActiveRecord::Base or

CTRL + SHIFT + ALT + N Search for any symbol in your application, like CSS classes, Ruby classes, methods, helpers etc...

In tests, it is sometimes useful to create records with specific ids. On PostgreSQL this can cause problems: Usually, PostgreSQL...