} start your server as usual, but go to https://localhost:3000 bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for...

...deployed to the servers. The gems of these groups might not be loaded by rails, however, the deployment process will take longer as the gems will be downloaded and installed...

kernel.org

...mind that you may need to migrate your database as Git is unaware of Rails and will not cast any magic. If Git checked out a commit that is working...

github.com

...ETag for responses that only differ in CSRF tokens or CSP nonces. By default Rails uses Rack::ETag to generate ETag headers by hashing the response body. In theory this...

...would enable caching for multiple requests to the same resource. However, since most Rails application layouts insert randomly rotating CSRF tokens and CSP nonces into the HTML, two requests for...

stackoverflow.com

To reload a single-item association in Rails 5+, call #reload_ : post.reload_author In older Railses you can say post.author(true...

...excludes quote characters so you can easily paste the secret into a Ruby string Rails can also generate secrets that can be used for secret_key_base: $ bin/rails secret 5693040b90b1b09d0a73364d950f15e3a9604403c8e81c6e5bb8b51d0981ef3bbde15a52bf5df41ac4974675bb8e31d69d03490dc11abd1086c873783d1be607

geekytidbits.com

ORDER BY category DESC, created_at; The easiest options to achieve this in Rails ActiveRecord is to use "WHERE ID IN" with User.where(id: Post.distinct_on_user.pluck(:user_id)).order(...)

...The following setup allows you to start Terminator in a split view with the Rails server running in the left pane and all remaining processes running via foreman in the...

type = Terminal parent = child1 profile = default command = env startup_cmd="bundle exec rails server" startup_attrs="-p 3000" bash [[[terminal3]]] type = Terminal parent = child1 profile = default command = 'env startup...

linux.die.net

...also use Cookies with cURL. For easily making HTTP requests in an IRB or Rails console, take a look at the HTTP gem. If you prefer a GUI, take a...

...we still recommend the solution in this card. If you need to synchronize multiple rails processes, you need some shared resource that can be used as a mutex. One option...

haml.info

%span Reference %pre ~ content Reference Hello World Textareas In some versions of Haml + Rails, this may also be an issue for textarea elements. Fix it similarly: # Indented description

...generated for associations. Warning Don't use query_attribute on associations. In case of Rails 7 you are getting an error. In Rails 6 this method is always responding with...

Use gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x-lts' # for Rails 2.x gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts' # for Rails...

...animated GIFs. Resizing them can be a time-consuming task and will block a Rails worker until the image is processed. Save yourself that trouble, and simply tell ImageMagick to...

where html_content can be replaced by one of the following commands: Rails body or response.body Capybara: page.driver.html.content page.body Webrat: Nokogiri::HTML(response.body).content The returned strings can...

...our older projects, we use the mysql2 gem. Unfortunately, versions 0.2.x (required for Rails 2.3) and versions 0.3.x (required for Rails 3.2) can no longer be installed on...

...to errors when compiling the native extension, or a segfaults when using it. For Rails 4.2, mysql2 version 0.4.10 seems to work okay. If you still have issues, upgrade to...

...need to configure this if you're using system tests with modern versions of Rails. They do exactly the same

Here is how to start your Rails application to accept both HTTP and HTTPS in development. gem install passenger Create a self-signed SSL certificate. Store the generated files in...

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

...So might fix this by adding the following lines to your application.rb: class Application < Rails::Application config.time_zone = 'Berlin' # or whatever your time zone end It seems Date.yesterday uses the...

...pass your string or stream directly. >> Attachment.create!(file: FileIO.new(contents, 'document.pdf')) => # When using zeitwerk (Rails 6) you might also need to add an inflection in order to make autoloading work...

stackoverflow.com

...method's source code If your Gemfile comes with method_source (a dependency of Rails 7+), you can can inspect the source code directly using the Method#source method:

...for example, you maintain a gem and want to run automated tests against multiple rails versions. When you need to bundle one of your secondary Gemfiles, the solution above is...

...preprocessed: true end end Preprocess this version for all existing records bundle exec rails runner 'User.find_each { |user| user.avatar.variant(:preview).processed }' Use the new variant and deploy