Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

379
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda