Make sure you call the methods in the following order and not vice versa: has_attached_file :image validates_attachment_presence :image Validation with condition works fine, too: validates_attachment...
When we inspected the process using strace we saw a blocking select system call. You can get backtraces for each thread by sending the TTIN signal to the Sidekiq...
...not want to run them every time. In order to skip all Selenium scenarios, call Cucumber like this: cucumber --tags ~@javascript Note that you should still run all the scenarios...
...queries. If you want to discard the cached results for one model, you can call MyModel.connection.clear_query_cache...
...object appears in the scope). Angular's $watch returns a method that you can call to remove that watch. For example: unwatch = $scope.$watch 'user', (user) -> if user?
...# do something...
When you are calling Bundler from your shell scripts, you might find it useful that a failed bundle call returns a different error code depending on the type of problem...
...way to use the jobs to be done philosophy to help define features. I call them Job Stories...
If you need to call a state_machine event and do not want to re-define resource_controller's create method, try this: create.before do object.state_event = :launch_spaceship
...the new TracePoint API for execution control and the new Debug Inspector API for call stack navigation, so it doesn't depend on internal core sources. It's developed as...
How to define and call class methods in CoffeeScript classes: class Foo @classMethod: -> @otherClassMethod() instanceMethod: -> @otherInstanceMethod() @constructor.classMethod...
...the lambda? status of the object. if object is not a Proc, it first calls #to_proc on the object and then converts it into a block...
...to Settings Manager / Keyboard / Application Shortcuts Add a shortcut for the Print key that calls xfce4-screenshooter -f This may be configured for you by default...
year 1951 end trait :moody do title 'Interstellar' end end You can now call them from Cucumber Factory like this: Given there is a movie (vintage, moody...
When your Rails controller calls render, you can pass a :status option for the HTTP status code: render 'results', status: 400 All important status codes also have a symbol alias...
TL;DR You shouldn't call $scope.$apply() or $scope.$digest() inside a function that can be invoked by Angular – e.g. in an ngClick. The linked Stackoverflow answer has a...
...care of this automatically. They do this by wrapping all assertions into a helper called patiently do, like this: Then /^I should see "([^\"]*)" in the HTML$/ do |text| patiently do...
...fetched body from the page, then body is removed from the DOM. The patiently call will then always fail since we never re-fetch a fresh body. Prevent stray javascript...
...emoticons are some of the most expressive and useful ones. Hidden codes (skype) (ss) (call) (talk) (u) (U) (o) (O) (time) (e) (m) (~) (film) (movie) (mp) (ph) (drunk) (punch)
If either side is an ActiveRecord scope rather than an array, you should call to_a on it first, since =~ does not play nice with scopes: actual_scope.to_a.should =~ expected_scope.to_a...
...to use FFI which is a bit awkward (see the gem's code), or call commands like df -B1 and search the strings for your relevant data. That gem takes...
Interesting hack to move expensive JSON.parse calls out of the main thread...
To only stub a method call if a given argument is used, but use the default implementation for other arguments: object.should_receive(:some_method).and_call_original object.should_receive(:some...
As Bill Dueber has on his blog, you can call rvm in the shebang to select a Ruby version like this: #!/usr/bin/env rvm 1.9 do ruby Standard arguments to do...
...boss and lost track of where you actually are in your code? No problem: Calling "l=" will show you the current file and line. That's a lower-case L...
...and an equals sign. "where" (or "backtrace") will give you the debugger call stack, including current file and line as well. It can be quite long...
Takes a screenshot when you call it, or when a test fails...