...like keeping the latest update timestamp in a separate place that is inexpensive to read from, and now just want to pass that timestamp to fresh_when. The problem
It's 2024 and we have tools like ffmpeg, imagemagick and GPT readily available. With them, it's easy to convert texts, images, audio and video clips into each other...
...table (like other_table.column), ActiveRecord will go with option 2 and build a joined table. Read below for more information about this issue. In Rails3+ you can also disable this annoyingly...
...examples can get quite long, especially in feature specs. This makes them hard to read & understand. Also, when executing them, it may take seconds to see any progress.
...binary string which we can use to create a file binary_string = binary_data_array.pack('C*') Read the docs for more information about packing data in ruby Caveats make sure you can...
...inside the gem. ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control...
...possible products, categories and vendors and it is updated once a month. When you read this file with the Nokogiri default (DOM) parser, it creates a tree structure with all...
...easily navigate through it via css/xpath selectors. The only problem is that if you read the whole file into memory, it takes a significant amount of RAM. It is really...
config.file_fixture_path = "spec/custom_directory" end Alternatives: Rails.root.join('spec/fixtures/files/avatar.jpg').open('r') Rails.root.join('spec/fixtures/files/avatar.jpg').read File.open('spec/fixtures/files/avatar.jpg') (might only work if you run the command from the Rails root directory...
...tier (in Bootstrap e.g. "xs" or "md") without duplicating breakpoints to JavaScript: you can read the current breakpoint tier(s) in JavaScript...
...run into the limits of our previous approaches (e.g. ChoiceTrait cannot be internationalized). Please read the assignable_values README to familiarize yourself with the new solution. Also see our instructions...
...will match This test. possessive: specified by adding a plus sign to the qualifier. Reads like "greedy without backtracking" – *+ and ++ try to match everything but immediately return if it doesn...
I used two lab days to read the The framework field guide - Fundamentals, the first of a three part series to learn the basics of frontend technologies. I can highly...
...s logger utility, it is often useful to sync them. So other process can read the output just in time. Example with enabled sync log_path = '/tmp/some_log.log' log_file = File.open...
...OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 Re-read permissions When you're done making the above changes, we need to re-read mysql...
If you ever need to restore exact records from one database to another, Marshal might come in handy. Marshal.dump is...
Reading a URL via GET: curl http://example.com/ Defining any HTTP method (like POST or PUT): curl http://example.com/users/1 -XPUT Sending data with a request: curl http://example.com/users...
...password@example.com/users/1 -XPUT -d"screen_name=batman" Check the man page for more features. Read more You can also use Cookies with cURL. For easily making HTTP requests in an...
config.secret_key_base = config.secrets.secret_key_base def secrets config.secrets end config_for reads from config/secrets.yml. It expects config to be nested by environment. def secrets defines that method...
...you usually use is probably a bit too small and makes code hard to read for users on smaller screens or low-bandwidth connections when the image quality is lower...
...Version 4.6 introduces deprecation warning for Redis.current, which will be removed altogether in 5.0. Read this card for ways to deal with this. Now we can determine the correct REDIS...
...true } to activate this behavior. Note that since this executes a function on every read, this is slower than a dumb property. Full example Full example from the docs:
The NestedHash class allows you to read and write hashes of any depth. Examples: hash = {} NestedHash.write hash, 'a', 'b', 'c', 'value' # => { a: { b: { c: 'value' } } } NestedHash.read hash, 'a', 'b', 'c...
...b: { c: 'value' } } NestedHash.read hash, 'foo', 'bar' # => undefined Inspired by victusfate. Code class @NestedHash @read: (objekt, keys...) -> if objekt and keys.length @read objekt[keys[0]], keys[1...]... else objekt
# config/deploy/production.rb (analog to config/deploy/staging.rb) ... server ' ', user: ' ', roles: %w(... webpack) Make sure to read as well: Webpack(er): Serving identical assets from all servers. Capistrano: Speeding up asset compile...
You can use this Code Pen to play around with the different options. Read Inspect Grid to check for full details. Discover The Layouts Pane to inspect
...the two linked files, dummy_ok.pdf and dummy_fail.pdf. Both are valid PDF files, your PDF Reader will be able to open them and they seem to be the same. But if...
...fool the binary? method. But how can we check if a file is entirely readable with our preferred encoding (We'll use the default UTF-8)? The following method tries...