...flag trait from the card above, you can drop the does_flag trait the includes in all your models Note that the following code from the does_flag trait is...
...using a callback. before_initialize :set_newsletter private def set_newsletter return unless [nil, ''].include?(receive_newsletter) self.receive_newsletter = (user.role == 'customer') end Note: When using active_type, the attribute method...
...path with e.g. url_for (excluding :host and similar). Note that it does not include query parameters. Use params.to_unsafe_h returns a HashWithIndifferentAccess with everything from params. If none...
...with many built-in functions to manipulate color. Some of the more interesting functions include: adjust-hue($color, $degrees) Changes the hue of a color. lighten($color, $amount)
...of the project? Do you have to correct further estimates accordingly? Our estimates always include a percentage markup for organization and project management anywhere between 10% and 30%.
...must only differ in their conditions (#where, #having). If either side has a #join, #includes, etc., it will throw an error: authorized_users.and(filtered_users.join(:account)).to_sql # => ArgumentError: Relation passed to...
@cards = Card .where(...) .preload(:user, :deck) .to_a end end You can include strict_loading somewhere in the scope chain: class CardsController < ApplicationController def index @cards = Card
...access to some path methods generated by your routes. Even though you could technically include Rails.application.routes.url_helpers, this may include way too many methods and even overwrite some class methods...
...an escape sequence like this: echo -en "\033]0;Hello\a" You can easily include the current path: echo -en "\033]0;$(pwd)\a" Or, to replace your home directory...
...Product owner (PO): with the customer Developer Development Take responsibility for their stories. This includes always gathering all necessary information from the project lead or the PM, communicate blockers, make...
...engineering with the customer Create stories with the project lead Communicate with the customer, including tunneling questions of developers (or have them talk to the customer directly, if required)
...new gem named memoized. memoized is API-compatible to memoizer, you just need to include Memoized instead of Memoizer: class A include Memoized memoize def hello 'hello!' end
...the file structure on disc. A general approach Part A: Create a commit which includes a script that allows you to copy the existing file to the new file structure...
Undoing a broken text is very hard or impossible. The text can include any type of file link (e.g. link to profile image) and not only image links...
ruby-warning adds custom processing for warnings, including the ability to ignore specific warning messages, ignore warnings in specific files/directories, include backtraces with warnings, treat warnings as errors, deduplicate warnings...
...release, shipping many features and quality-of-life improvements requested by the community. Highlights include a complete overhaul of history handling, form state switching and the preservation of [up-keep...
...during rendering. ⚠️ These events are now emitted when the URL changes for any reason, including: When a script calls history.pushState() or up.history.push(). When a script calls history.replaceState() or up.history.replace().
...necessary, because you now load those libraries through esbuild. adapt your app/assets/config/manifest.js file to include only the folders that sprockets needs to take care of, e.g.: //= link_tree ../builds/
...automatically installed packages that no other packages depend on any more. This, of course, includes obsolete kernel versions, with the explicit exception of the currently running kernel, the kernel version...
...Use a test harness A test harness is a Ruby module that you include in the Cucumber world. This way the module's methods become available to all step definitions...
Modern JavaScript includes Intl.NumberFormat to format numbers in different formats and locales. In this card, we describe a wrapper for it that humanizes a given number of seconds in the...
...of all commands in the byebug guide The linked cheatsheet at the bottom also includes some examples and all the aliases to every command with a different useful structuring of...
...need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib...
--srcdir=. --curdir --ruby=/home/user/.rbenv/versions/1.9.3-p551/bin/ruby --with-ruby-dir --without-ruby-dir --with-ruby-include --without-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib...
If you need to use safe_join() in a model, you need to include ActionView::Helpers::OutputSafetyHelper. Rails 2 Roll a custom join method that is aware of Rails...
...seems to be really eager to maintain the library it requires no configuration (just include it to your page), but offers a powerful API it was written to be performant...
...Corresponding Rails Guide Controller generators Rails ships with a ResourceHelpers module. Require 'rails/generators/active_model' and include Rails::Generators::ResourceHelpers inside your generator class to have some helpers at hand, i.e. controller...
...use "git restore --staged ..." to unstage) deleted: app/assets/stylesheets/pagination.sass Untracked files: (use "git add ..." to include in what will be committed) app/assets/stylesheets/pagination.sass Now use fixup to add the commit to delete...
PostgreSQL, unlike MySQL, treats strings as case sensitive in all circumstances. This includes comparison with = and LIKE collision detection in unique indexes Usually this is fine, but some strings (like...