...When you want to call methods from A inside B you would normally just include A into B: module B include A end Including exposes all of A's methods...

A cleaner way would be like this: module B module Outside include ::A module_function :foo end end This allows you to use B::Outside.foo or just...

Rails includes milliseconds in Time / DateTime objects when rendering them as JSON: JSON.parse(User.last.to_json)['created_at'] #=> "2001-01-01T00:00:00.000+00:00" In RSpec you might want...

...or link to available solutions. Global access to Rake DSL methods is deprecated. Please include Rake::DSL into classes and modules which use the Rake DSL methods. Open your Rakefile...

...and add the following line above YourApp::Application.load_tasks: YourApp::Application.class_eval do include Rake::DSL end Use of ole/file_system is deprecated. Use ole/storage (the file_system api is recommended...

...extract_css: true 3. Change stylesheet_link_tag to stylesheet_pack_tag and javascript_include_tag to javascript_pack_tag 4. Replace image_tag with image_pack_tag if it...

...which parts of a library you want to import to your project. Many gems include everything because it was not possible otherwise. But now you can choose if you need...

...poses some risk when you render user input, since it might be feasible to include data from the local filesystem into the PDF. Therefore, the usual XSS protection techniques should...

docs.gitlab.com

Use rules to include or exclude jobs in pipelines. Rules are evaluated in order until the first match. When a match is found, the job is either included or excluded...

...these step definitions: Then /^I should not see an error$/ do (200 .. 399).should include(page.status_code) end Then /^I should see an error$/ do (400 .. 599).should include(page.status...

...virtual attributes with full coercion magic is to use Virtus: class User < ActiveRecord::Base include Virtus.model(:constructor => false) attribute :name, String attribute :age, Integer attribute :birthday, DateTime end

user.age = '65' user.age # => 65 user.birthday = '17.11.1982' user.birthday => DateTime<#...> Note how we had to include Virtus with the :constructor => false option so it doesn't overwrite the initializer provided by...

...methods to synchronize the string array with its underlying association: class Note < ActiveRecord::Base include DoesListField[:topic_list] private def read_topic_list topics.collect(&:name) end def write_topic_list...

...the :integer option so elements get casted to numbers automagically: class Note < ActiveRecord::Base include DoesListField[:author_list, integer: true]

rhnh.net

In order to cover some edge cases you rarely care about, Range#include? will become very slow in Ruby 1.9: Range#include? behaviour has changed in ruby 1.9 for non...

...or max) [...] Ruby 1.9 introduces a new method Range#cover? that implements the old include? behaviour, however this method isn’t available in 1.8.7. The attached code will add a...

cssdiscussion.com

...device-width: 1024px)' %> Here I chose 1024 pixels as the maximum device width to include the iPad. If you want to target only mobile phones, pick 960 to include high...

Recent IRB versions include a multi-line autocomplete which may be helpful to novice users but can be distracting. Cycling through options works by pressing the Tab key (as usual...

blog.mastermind.dev

...very helpful to refresh my understanding of database indexes. As a small bonus, it includes a few helpful SQL oneliners like these two: Detecting unused indexes Detecting duplicate indexes

api.rubyonrails.org

...key that the params will be wrapped into. class UsersController < ApplicationController wrap_parameters :person, include: [:username, :password] end And there is more! Check the attached link for other features ...

...you use Form Models you need to add virtual attributes manually. E.g. wrap_parameters include: User.attribute_names + ['send_email...

...not_acceptable) end end end end Note: request.format more reliably tells the format, but includes Rails-required formats such as application/x-www-form-urlencoded (which we must not refuse). For our purposes, getting...

...installed will not be reinstalled for the new RubyGems or Bundler. Some gems may include binaries that are turned into binstubs by RubyGems and thus implicitly rely on a certain...

...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...

--without-make-prog --srcdir=. --curdir --ruby=/home/thomas/.rvm/rubies/ruby-1.8.7-p374/bin/ruby extconf.rb:15: undefined method `include_path' for Libv8:Module (NoMethodError) This is caused by therubyracer's extconf.rb requiring libv8 without Bundler...

makandra dev

...more consistent. The steps use "( not)? " now. The search via spreewald some query here includes steps with optional negation now...

There seems to be a nasty bug in Chrome 56 when testing with Selenium and Capybara: Slashes are not written...

...If you want to enable OS upgrades using do-release-upgrade make sure you include $release-proposed packages in the mirror script, e.g., precise-proposed. Additionally, you have to add...

...your script as debmirror silently ignores some directories. I attached our modified script to include current releases Enable Ubuntu release upgrade from the local mirror Download the following two files...

...matched on method and URI. However, no request URI will equal another when they include a nonce. You won't be able to match these requests with VCR. Solution

# spec/support/vcr.rb or wherever you need it VCR.configure do |config| # For matching requests that include OAuth params in the query string config.register_request_matcher(:oauth_uri) do |reqA, reqB|

In FactoryBot factories, Rails' file_fixture is not available by default. To enable it, include a support module from rspec-rails: FactoryBot::SyntaxRunner.include(RSpec::Rails::FileFixtureSupport) That includes ActiveSupport::Testing...

The proxying server adds a header X-Forwarded-For to every request. It includes the original client IP. You can include that header in your access log by using...

...just does memoization and does it well. The syntax is similiar also: class Foo include Memoizer def bar ... end memoize :bar end If you're using Ruby 2.1+, you can...

...write this even shorter: class Foo include Memoizer memoize def bar ... end end This is because def returns the method name as a symbol in...