You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...

We use RTeX for PDF exports. While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions...

makandra dev

You don't need a Rails application to use Sass. Even when you're working on a static site you...

beust.com

It’s pretty common for projects hosted on GitHub to receive “pull requests”: requests from people who have cloned your...

When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...

You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...

First of all: You could just use RVM which would make the pain go away. If for some reason you...

github.com

You can use the whatlanguage gem to detect the language of a Ruby string. Note that it also has not...

wmd-editor.com

WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD...

Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit...

When submitting textareas, browsers sometimes include carriage returns (\r) instead of just line feeds (\n) at the end of each...

makandra dev

There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...

makandra dev

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...

makandra dev

If you added a file by mistake, you can unstage it (but keep local changes) by saying git reset HEAD...

Rails 3, 4, 5, 6 config/application.rb config/environment.rb before the initialize! call (we don't usually edit this file)

makandra dev

Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.

github.com

There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define

When deploying Rails applications you might have noticed that JS and CSS are not cached by all browsers.

When working with times and dates in Rails applications, you need to deal with the following problem: In Rails, Time...

Use this if you want to show or hide part of a form if certain options are selected or boxes...

The Git stash does not work like a one-slot clipboard and you might shoot yourself in the foot if...

So you screwed up and copied Paperclip secrets from one project to another. Here is a semi-automatic, painful way...

makandra dev

The following counts all the lines in all *.rb files in the app directory. Run several of these commands to...

stackoverflow.com

Reverting a commit means creating a new commit that undoes the old changes. Imagine the following commit history: