NameError in AttachmentsController#indicateur


NameError in AttachmentsController#indicateur



I'm on Ruby on rails and I started with the library axlsx_rails.



By cons when I get my data from my table to put it in an xlsx file it gives me this error



undefined local variable or method` attachment 'for # <
AttachmentsController: 0x007f7d8ecf1a08> Did you mean? Attachment_url



I attach the files of my program if someone has any idea. Thank you.
route.rb



view: indicateur.xlsx.axlsx



controller



view: indicateur.html.erb





Next time please post your code, do not post an image.
– araratan
Jun 29 at 9:53




1 Answer
1



It is giving you that error because it is looking for attachment method. I believe you want to do is to fecth all the attachments. So instead of you code:


attachment


@attachments = attachment.all



You should upcase the Model:


@attachments = Attachment.all





@mor diop I think make a different thread for that. And it seems my answer solved your issue above, so you can accept my answer.
– araratan
Jun 29 at 10:06






Create another thread for that. It is a different topic.
– araratan
Jun 29 at 10:13





of course it solved it and thank you for that but I have another problem I have this problem after having to solve the first problem i have this 'To respond to a custom format, register it as a MIME type first: guides.rubyonrails.org/…. If you meant to respond to a variant like :tablet or :phone, not a custom format, be sure to nest your variant response within a format response: format.html { |html| html.tablet { ... } }' thanks for your help
– mor diop
Jun 29 at 11:12






You should accept the answer if it solved the issue not just saying thank you or +1 here in the comment.
– araratan
Jun 29 at 13:11






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Export result set on Dbeaver to CSV