When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly all commands. # Migrate rake db:migrate rake db:migrate STEP...
...rake db:migrate VERSION=20080906120000 # Redo rake db:migrate:redo rake db:migrate:redo STEP=2 rake db:migrate:redo VERSION=20080906120000 # Rollback (starting from latest migration) rake db:rollback...
With Rails 4, Concerns have become the “official” solution to the big-models problem. However, there’s a fair amount of controversy about this topic in the community. Not everyone...
...is convinced that Concerns are the “right“ solution to the problem of AR models becoming too big. In this talk we will see what Rails Concerns are and how can...
The linked article has a great explanation how to to deal with string encodings in Ruby. Furthermore you can check out some of our cards about encoding: Ruby's default...
...encodings can be unexpected How to fix invalid byte sequence in UTF-8 error
When you put a Rake task into lib/tasks, but running it fails with... Don't know how to build task...
...or overflow directives in your CSS. Remove and tags in proximity of your table (seriously...
...multiply a BigDecimal with another BigDecimal, the result will be a new BigDecimal with sufficient precision to represent the result. No rounding or clipping should occur in that operation.
...means you just transitioned back into the land of random rounding errors. Don't screw up your clean BigDecimal values by thoughtlessly multiplying them with a Float. For instance, this...
not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's Guide...
Safari & Chrome Use $x() in your console: $x('//span') # selects all span elements Firefox There's an add-on...
If your Snom 300 always keeps the same volume for headset and ringtone (as soon as you change one you also change the other), here's what to do:
...to your phone settings web interface, then Preferences (German Präferenzen). There is the seemingly harmless setting for Ringer Device from Headset (German Klingeltonausgabe bei Kopfhörer). Choose one: "Headset" or "Speaker...
Since I'm a software architect and a web developer, I get often approached by people with their new ideas. In most cases, for some quality feedback, and on lucky...
...rough quote about the costs of such a project. These people are usually very secretive about what they have, making me explain to them that it's far from my...
Pour color on your Rails console with awesome_print. Turn confusing long strings into formatted output. Have objects and classes laid out clearly whenever you need it. Put gem 'awesome...
...ap that will give you a colored, formatted output of whatever you pass it. See the example output of the User class below. For customization visit the repository on Github...
url = 'http://www.foocorp.com/foo/bar' URI.parse(url).host # => www.foocorp.com Note that this will raise an error if the given argument is...
...base revision from which both conflicting versions are derived You can also use a similar pane view to compare to files. Mark two files and press Ctrl + D to compare...
Bundler 2 introduced various incompatibilites und confusing behavior. To add to the confusion, Bundler's behavior changed after the release...
If you're on Ubuntu: sudo apt-get install ruby-dev On other platforms: Look for a package containing ruby header files. On Red Hat that's "ruby-devel" likely...
If you get the above error when running tests in bulk (but not individually), it's actually the fault of...
Bash stores the exitcodestatus of piped commands in the environment variable PIPESTATUS So you can just echo ${PIPESTATUS[@]} to get them all. 13:52:30 ✔ claus:~$ ps ax | grep /usr/bin/ruby...
...PIPESTATUS is an array, so you can get the exitcode of an specific command (first pipe): 13:54:20 ✔ claus:~$ echo ${PIPESTATUS...
When you drag a file from a Nautilus window into a terminal window, the file's path will be pasted...
If you need a gem for a certain purpose, be sure to check this site. The rankings are determined by counting up the number of forks and watchers of various...
...under active development and fairly up to date, and it's very useful to see groups of gems broken down by category...
Bryan talked about the differences between imperative and declarative scenarios. In my opinion, both styles have benefits and should be used appropriately based on the situation. The majority of examples...
...on rspec's story runner currently on the web, including mine, are of the imperative type. Since the declarative type has many advantages I thought it would be worth while...
Small (1.5 KB) Javascript library that lets you render tables, lists, etc. with hundreds of thousands of items. How it works is that you move your data set from the...
...DOM into JS. Clusterize than makes sure only the rows in the viewport (and adjacent batches) are rendered. I believe that AngularUI's data grid component uses a similar technique...
Parses URLs of social networks to extract IDs or screen names. It does not get confused by child routes: you may also pass URLs like a user's twitter photo...
...stream and the gem will extract their twitter ID . Note that it just parses URLs, and does nothing magic like looking up IDs when the URL contains only a screen...
...is that the purpose of refinements in Ruby 2.0 is to make monkey-patching safer. Specifically, the goal is to make it possible to extend core classes, but to limit...
...the effect of those extensions to a particular area of code. Since the purpose of this feature is make monkey-patching safer, let’s take a look at a dangerous...
Non-static elements will not inherit their parent's opacity in IE for no good reason. This can lead to unexpected behaviour when you want to fade/hide an element and...
To fix it, give the parent element defining the opacity a non-static positioning. For example: .parent { opacity: 0.2; position: relative; /* for IE */ } While the linked article describes...