How to fix strangely disappearing or misbehaving forms
Nested form elements can vanish or submit the wrong data because browsers handle invalid form markup inconsistently, especially during Ajax updates.
Use CSS attribute selectors with Capybara
Quoted CSS attribute selectors let Capybara check meta tags reliably; unquoted values can trigger Nokogiri CSS syntax errors.
Collect an array of IDs from any object
Normalize records, scopes, and integers into ID lists with collect_ids, making scope arguments accept single objects, arrays, and numeric scalars.
Fix "undefined method `destroy'" in reset_session
Rails 2.3.11 has a bug where reset_session raises undefined method destroy'; copying an initializer to config/initializers` works around it until a maintenance release.
thoughtbot/capybara-webkit
Capybara driver for browser testing with QtWebKit when JavaScript support is needed.
makandra/consul
Our new scope-based authorization gem for Ruby on Rails has been released. This might one day replace Aegis as our standard authorization solution.
List your current Git remotes
git remote -v lists configured repository endpoints and shows which URLs are used for fetching and pushing.
Convert RDoc markup to HTML
Render a README.rdoc file as HTML with rdoc; the generated output lands in doc/index.html, and doc should stay uncommitted for gem work.
Why preloading associations "randomly" uses joined tables or multiple queries
ActiveRecord :include can switch between separate queries and SQL joins, causing ambiguous ORDER BY clauses and hidden production bugs when associations are preloaded.
jeanmartin/konto_check
Ruby gem to check whether a given bic/account-no-combination can possibly be valid for a German bank. Can also resolve German bank names from a given bic.
Use non-ASCII characters on IRB and Rails consoles with RVM and Mac OS X
Missing readline support prevents non-ASCII input in IRB or Rails consoles on Mac with RVM; reinstalling Ruby with readline enables 8-bit characters.
Cast a string to the type of an ActiveRecord attribute
ActiveRecord columns can convert string input to the underlying attribute type, such as integers and booleans, using column metadata.
Retrieve the SQL query a scope would produce in ActiveRecord
Get the SQL generated by an ActiveRecord scope without executing it; Rails 3 uses to_sql, while Rails 2 needs a backport or construct_finder_sql.
How to perform HTTP basic authentication in RSpec
HTTP Basic Authentication sends a Base64-encoded username and password in the Authorization header; RSpec tests can set credentials for request and controller specs.
Debian/Ubuntu: See what "apt" would install without actually doing it
Check which packages and versions apt would install before making changes. --dry-run simulates upgrades without touching the system.
Installing RubyGems for Ruby 1.8.6
Ruby 1.8.6 is incompatible with newer RubyGems releases; RubyGems 1.4.2 remains the last version that installs successfully.
Dropbox + git = Designer <3
One of the thornier problems in our workflow is knowing when assets are delivered from the designer and keeping them in sync with our application as they change. We used to use e-mail, Skype or sticky notes. The trouble is that the designer's file naming and directory structure were never quite the same as the application's /public/images directory, so direct comparisons were impossible and we ended with a lot bookkeeping to make sure that we didn't lose any changes. Our solution is to clone the project's git repository into a folder inside ...
Open the on-screen keyboard on an iPhone or iPad with Javascript
iPhone and iPad browsers do not allow JavaScript to open the on-screen keyboard programmatically. The keyboard appears only after a user gesture in an editable field.
Installing RMagick on Ubuntu
RMagick gem installation can fail when ImageMagick development files or config tools are missing. Installing the matching libmagickcore-dev and libmagickwand-dev packages usually resolves it.
Opera: How to use outlining for better layout debugging
Opera’s User mode can toggle HTML element outlines quickly, making layout debugging easier when actual element dimensions and float behavior matter.
Opera 11: Show full address, including GET parameters
Opera 11 hides URL parameters and the protocol in the address field until focus, making copied links incomplete. A browsing preference restores the full web address display.
Default views in Rails 3.0 with custom resolvers
It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let’s say you have a bunch of controllers inside the Admin namespace and you would like each action to fallback to a default template. So if you are rendering the index action for Admin::PostsController and “app/views/admin/posts/index.html.*” is not available, it should then render “app/views/admin/defaults/index.html”.
Since Rails 3.0, we have a new abstraction called resolvers that holds the logic to find a template.
How to send a test e-mail from shell
Manually verify outbound e-mail delivery from a machine with mail from the shell, either empty or with a typed message body.