Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
Lazy Load to image_tag Rails

So apparently this commit adds a configuration option to define the default value of the image_tag :loading option. Thus by setting, config.action_view.image_loading an application can opt in to lazy loading images sitewide, without changing view code.

config.action_view.image_loading = "lazy"

However when I try to add it to my development.rb or production.rb I get the following error :

1: from /Users/cash/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.3.2/lib/action_view/railtie.rb:46:in `each'
/Users/cash/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionview-6.1.3.2/lib/action_view/railtie.rb:53:in `block (3 levels) in <class:Railtie>': undefined method `image_loading=' for ActionView::Base:Class (NoMethodError)

Rails version: 6.1.3.2

Ruby version: ruby 2.7.1p83

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is not yet available in stable rails, it will be available in rails 7, and if you need to do it now, you can switch to depend on the git main head:

git 'https://github.com/rails/rails.git' do
  gem 'railties'
  gem 'actionpack'
  gem 'activemodel'
end

You can see it by going to the merge commit: https://github.com/rails/rails/commit/3c2a80d8b1d4730897a7040b7f563d0027aa1e83 and checking just below the title. It shows the branches and tags this commit belongs to (in this case, only main):

enter image description here

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!