Rails 5 gem gon not recognize jbuilder file

164 Views Asked by At

I have implemented rails gem gon in index method and it works fine. But when I try to implement in controller#new it is not working this is my error output:

No such file or directory @ rb_sysopen - app/views/cuenta_proveedors/new.json.jbuilder

but i have already create this file.

this is my controller

def new
@cuenta_proveedor = CuentaProveedor.new
@cuentas = @negocio.cuenta_proveedors.order(:created_at)
gon.jbuilder  // THIS LINE CAUSE THE ERROR SHOWN BY APPLICATION TRACE

end

i have the created the file new.json.jbuiler

json.cuenta_proveedores @cuentas do |cc|

  json.proveedor cc.proveedor.nombre
  json.inicial cc.monto_inicial
  json.saldo cc.monto_adeudado
  json.observacion cc.observacion
  json.token cc.token
end

Why is this happening? I can not found any logic to this error. If you need more information ask me . Thanks

0

There are 0 best solutions below