In order to redirect all requests from redirecting-host.com to desired-host.com while keeping path and query params unchanged, change your Apache...

You configured authentication in your Apache configuration that requires username and password but you want a single IP address, host...

makandra dev

To clear the query cache in your MySQL database manually, e.g. for database profiling, execute the following command in your...

So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...

When you eagerly load an association list using the .include option, and at the same time have a .where on...

opensoul.org

Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...

Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "&lt;élan&gt;"

snippets.dzone.com

These two models can be used to access the posts and associated comments of a WordPress database.

makandra dev

If you modified git's history and the change was already pushed, you will usually get a ! [rejected] my-branch...

To change the commit message of the latest (unpushed, unmerged) commit, you can use git commit --amend

Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...

makandra dev

Lets say you need to make a change to a commit OLD_COMMIT, but this is not the most recent...

You can get YAML.load to instantiate any Ruby object by embedding the desired class name into the YAML code. E.g...

If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...

apidock.com

To temporarily change the current working directory in Ruby, call Dir.chdir with a block. The previous working directory will be...

yehudakatz.com

The first thing you need to understand is that the purpose of refinements in Ruby 2.0 is to make monkey...

If you need to do calculations inside the database and can not use Ruby objects you may run into problems...

When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...

When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...

Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...

Don't insert table rows in a Rails database migration. This will break tests that expect that database to be...

Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.

To change a commit message of the most recent (unpushed) commit, you can simply use git commit --amend -m 'new...

Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...