...is defined incorrectly. Raise the attributes hash given to your :reject_if lambda to see if it looks like you expect. If you are nesting forms into nested forms, each...
...a new parent record together with a new child record and will need to save the parent before you can save the child. You can opt to only show the...
...Adding Records via XHR and JS Example For the following examples we use a simple data model where a user has zero or more tasks. class ExampleMigration < ActiveRecord::Migration...
...user.tasks.build } end def update load_user @user.attributes = user_params if @user.save flash[:notice] = 'User saved successfully.' redirect_to(edit_variant_1_user_path(@user)) else flash[:notice] = 'User could not...
Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine...
When a user shares your content, a snippet with title, image, link and description appears in her timeline. By default social networks will use the window title, the first image...
...the current URL and some random text snippet for this purpose. This is often not what you want. Luckily Facebook, Twitter, etc. lets you control how your content appears in...
...that matter) will not be affected by this. If you define them in your specs, they will exist globally. This is because of how RSpec works (short story: instance_eval...
# ... end let(:record) { TestRecord.new }
end # TestRecord will exist here, outside of the spec! Do not do this. It will bite you eventually. For example, when you try to...
...is how to view what Capybara is rendering. Rendered text (what the user actually sees) puts page.text Prints just the visible text body, completely stripped of HTML tags and hidden...
...cluttered with excessive blank lines, you can easily avoid printing them: puts page.body.gsub(/^\s*$/, '').squeeze("\n") Advanced DOM parsing with Nokogiri If the raw HTML is too massive to read...
There is an option you can set so that when using the cd command, small typos are automatically corrected. Add the following to your ~/.bashrc: # cd: autocorrect small typos and...
shopt -s cdspell Example: cd Porjects # Projects pwd # /home/judith/Projects Also, I recommend adding aliases for your most common typos of commands you regularly use to your ~/bashrc...
...enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not...
...just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language...
...T06:22:17.484221 #2698200] INFO -- : [53a240c1-489e-4936-bbeb-d6f77284cf38] more Goal When searching through Rails logs on production, it's often hard to see all lines that belong to...
...the same requests, since output of different requests is often interwoven. Instead, we want to find all requests that match a pattern, and then print all lines that share the...
When you create a temporary file (e.g. to store a generated Excel sheet) and try to send it to the browser from a controller, it won't work by default...
...this controller action: class FoosController < ApplicationController def download file = Tempfile.new('foo') file.puts 'foo' file.close send_file file.path end end Accessing this controller action will usually raise a 404 not found...
Rails wraps your parameters into an interface called StrongParameters. In most cases, your form submits your data in a nested structure which goes hand in hand with the strong parameters...
...However, there are cases where this does not fit your use case, or has side effects. If you do it differently, be extra careful not to introduce security issues.
Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux distribution and any OS X machine. This allows Ruby app...
...to bundle these binaries with their Ruby app, so that they can distribute a single package to end users, without needing end users to first install Ruby or gems...
...posts; if you use pagination the queries will be more complicated, but the point still stands. Looks harmless enough? It is not. The problem ActiveRecord will rewrite this into a...
...query using LEFT JOINs which looks something like this: SELECT "blog_posts".*, "comments".*, "attachments".* FROM "blog_posts" LEFT OUTER JOIN "comments" ON "comments"."blog_post_id" = "blog_posts"."id"
When you're using feature branches, they will stack up if you don't delete them after the merge to master. Here's how to tidy them up. Delete feature...
...Find already-merged branches by running # On branch master git branch --merged You may safely delete each of the listed branches, because they point to commits that are contained in...
#!/usr/bin/env ruby require_relative "../config/boot" require "active_support/continuous_integration" ActiveSupport::ContinuousIntegration.run do step "Setup", "bin/setup --skip-server" step "Security: Rubygems audit", "bundle", "audit" step "Security: NPM audit", "npm", "audit"
#!/usr/bin/env ruby require_relative "../config/boot" require "active_support/continuous_integration" ActiveSupport::ContinuousIntegration.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby", "bin/rubocop" step "Style: JS", "npx prettier", ".", "--check" step "Style: CSS...
window.getSelection().toString(); Browser support: IE9+, Android 4.3+, Safari...
Surprisingly exhaustive new icon set by Google. Available as PNG, SVG and as a icon font. Comment from Henning I tried using the icon set in a project. I found...
...the quality, selection and handling far worse than what we are used to in FontAwesome...
curl http://ipecho.net/plain; echo
The Paper elements are a set of UI elements that implement the material design system...
Impressive set of design guidelines from Google...
Declare an enum attribute where the values map to integers in the database, but can be queried by name.
...the dot-underscore (._foo, ._bar, etc.) files created by (badly-behaved) Mac OS X systems on non-AFP server volumes...
Since we are migrating from our homegrown mixins.sass and helpers.sass to Compass, here is a list of all the mixins provided by Compass...
...about what HTTP was designed for. The original post has been removed for some stupid gender discussion...