I am having a problem with uploading files. I want to allow users to upload files that the system allows...
For example, I allow files having an extension of *.j
Firstly you can use extname
method to validate files you are saving.
http://apidock.com/ruby/File/extname/class
Secondly I use Paperclip gem https://github.com/thoughtbot/paperclip for uploading files. There is validate_attachment_content_type method for validating extensions: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/ClassMethods#validates_attachment_content_type-instance_method