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...

Jasmine comes with two matchers that test for equality. The first is toBe: expect(first).toBe(second) toBe passes when...

github.com

The Bullet gem is designed to help you increase your application's performance by reducing the number of queries it...

The migration DSL now supports adding and removing foreign keys. They are dumped to schema.rb as well. At this time...

tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...

leomayleomay.github.io

Your after_commit callbacks will not know about changes, as Rails discards them when committing. The linked article shows a...

makandra dev
github.com

Sometimes you need to run background jobs that you can't make important guarantees about - they may run out of...

Large projects usually have large test suites that can run for a long time. This can be annoying as running...

In most of our applications, users have their first and last name stored in separate columns. However, specifying them separately...

When using ORDER BY "column" in PostgreSQL, NULL values will come last. When using ORDER BY "column" DESC, NULLs will...

github.com

When working with ActiveType you will often find it useful to cast an ActiveRecord instance to its extended ActiveType::Record...

Note: ActiveRecord::Base#becomes has a lot of quirks and inconsistent behavior. You probably want to use ActiveType.cast instead.

guides.rubyonrails.org

Starting from 4.1, Rails automatically detects the inverse of an association, based on heuristics. Unfortunately, it does not seem to...

postgresql.org

There is no such thing as a "default order" of rows in database tables. For instance, when you paginate a...

api.rubyonrails.org

ActiveModel supplies an errors object that behaves similar to a Hash. It can be used to add errors to a...

When you register a delegated event using on (or the deprecated delegate / live), it is somewhat hard to manually trigger...