...default to ordering the records by id in ascending order during an ordered finder call. class User < ApplicationRecord end User.first #=> SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT...

adobe.com

...ways to do this: The preferred way is to use the ExternalInterface class to call Javascript functions from ActionScript, and to bind ActionScript functions to the Flash movie's DOM...

...element so they can be called from Javascript. The deprecated way is to use the global fscommand function to call a Javascript function with a fixed name from Javascript. In...

...Make sure no developer has gone into a rabbit hole and is afraid to call for help Give everyone an idea what's currently going on

...defined at. Controller actions don't take any arguments, but some middleware trying to call the internal method may pass one or more arguments. See also Beware: Don't name...

tenderlovemaking.com

...They don't hide methods from inheriting classes.) private Private methods can only be called with implicit receiver. As soon as you specify a receiver, let it only be self...

...your call will be rejected. class A def implicit private_method end def explicit self.private_method end private def private_method "Private called" end end A.new.implicit # => "Private called" A.new.explicit # => NoMethodError...

makandra dev

...Interactive Git status. Run tig status. Stage/unstage with U, navigate with ENTER/Q. Stash management. Call tig stash, browse the stashes, apply with a, pop with p, drop with !. See Git...

}) JS expect(returned_latitude).to eq latitude end Note that we no longer call evaluate_async_script (or evaluate_script, if you're running synchronously) on page, but the...

...map element itself. Inside of the Heredoc we can then refer to map by calling this. By doing this, we no longer reimplement any logic in our test, gain control...

makandra dev
impactahead.com

...situation" where you are "inside" an object. This is especially handy when needing to call private methods – just invoke them, no need to use send. Switch to an object: chws...

...have a link to the source location on GitHub. CTRL+click on a method call in RubyMine. This will open a list of possible source locations. Note Given that Ruby...

...The monkey patch should print the number of attributes that will be set, then call the original method: movie = Movie.find(1) movie.attributes = { title: 'Sunshine', year: '2007' } # Console prints "Setting...

apidock.com

...may override the default accessors (using the same name as the attribute) and simply call the original implementation with a modified value. Example: class Poet < ApplicationRecord def name=(value)

...behaviors to your tests based on their type tag, for example enabling you to call get and post in specs with the tag type: :request. Alternatively you can skip these...

end end end You can find a full list of available dynamic calls below: Dynamic call Equivalent Power.current.send(:notes) Power.current.notes Power.current.include?(:notes) Power.current.notes? Power.current.include!(:notes) Power.current.notes! Power.current.include?(:notes...

...as a placeholder for the remote Rails root directory. # * Append ` || test $? =1;` to grep calls in order to avoid exit code 1 (= "nothing found") # * To be able to process the...

...require custom Capistrano task files: # Capfile Dir.glob('lib/capistrano/tasks/*.rake').each do |r| # `import r` calls Rake.application.add_import(r), which imports the file only # *after* this file has been processed, so...

github.com

...notification each third retry or use less retries. Also, if you make thousands of calls to an API it may not be wise to send emails if the API is...

...s own ancestors. As a conclusion of (2), a delegated listener will always be called after listeners registered directly on a descendant, regardless of the order in which the listeners...

Register a standard event listener to your target. Before you run your callback, check that the actual element (event.target) matches the desired selector, or has the desired selector...

it 'sends a xlsx export' do # create your exportable data create(:resource, ...) # call your export endpoint get '/backend/resources.xlsx' # check that all expectations are fulfilled expect(response).to be...

For this purpose the gem allows you to record execution time when you call rspec with --format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log. As the documentation on this states you...

github.com

...second argument to limit the number of applied splits Last Raised Exception In The Call Stack The $! global variable contains the last exception that was raised in the current call...

github.com

...implicit conversion of a Hash argument into keyword arguments. This conversion is performed by calling to_hash on the last argument to that method, before assigning optional arguments. If to...

...keyword arguments ... then it is not set as the first optional argument. Instead, Ruby calls to_hash on the object and tries to match the result to keyword arguments. If...

...freshly cloned project. The reason is your environment.rb which is loaded for Raketasks and calls Rails.application.initialize! which in turn may/will evaluate classes. If one of those classes is tries to...

# accessing "columns" raises an error and the application fails to boot. # # To allow calling "rake db:create" or "rake db:migrate" on an empty # database, we swallow such errors...

...we want to stop in the debugger for all following tests, when the :lock call runs into the after_save $debug = true expect { user.lock }.to change(user, :locked).from(false...

...and even though you probably only care about seconds. This means that two consecutive calls of Time.now probably return two inequal values. Consider freezing time in your tests so it...

...by adding this to your Capfile: Dir.glob('lib/capistrano/tasks/*.rake').each do |r| # `import r` calls Rake.application.add_import(r), which imports the file only # *after* this file has been processed, so...

...How to get the path to ../CHANGELOG.md independent of the working dir of the caller changelog = File.read(changelog_path)

...further actions here Ruby >= 2.0 changelog_path = File.expand_path('../CHANGELOG.md', __dir...