Category: ruby

  • My new rails application won’t display the “Yay!” page!

    I was doing some recent environment testing with rails with the same application created on each of OSX, CentOS, and Ubuntu and was surprised when the application gave an error about no root route available, instead of the “Yay!” page: I, [2020-02-12T16:51:06.845723 #46720] INFO — : [8d1ab83a-b4e4-45bf-a734-a6494c4d15c2] Started GET “/” for 127.0.0.1 at 2020-02-12 16:51:06 […]

  • Rails new fails to create all of the content…

    I recently deployed a Rails app on a CentOS 8 container and was surprised to see that the ‘rails new’ command did not create the entire application directory structure that I would expect, ie: [root@607ebc931c48 app]# rails _5.2.3_ new centos_app_2 create create README.md create Rakefile create .ruby-version create config.ru create .gitignore create Gemfile run git […]

  • Why is rails 5.2 joining to the same table twice?

    I was working on a Rails project for a client recently where I was trying to figure out why a model search operation was joining to the same table twice, resulting in a huge performance hit. The answer turned out to be an incomplete understanding of the ‘has_many’ ‘:through’ relationship. Given a model with the […]

  • Rails timestamp search using datetime_field_tag

    I recently worked on an issue when creating a Rails form to search and display objects by timestamp and spent far too much time troubleshooting an issue with the datetime_field_tag form helper. The issue began with the following two lines in my view: Evidently, you cannot place more than one space between the name assigned […]

  • ruby aws-sdk strikes again…

    When using ruby to upload files to S3 and trying to use multipart upload, beware the following ArgumentError: …param_validator.rb:32:in `validate!’: unexpected value at params[:server_side_encryption] (ArgumentError) … from /var/lib/jenkins/.gem/ruby/gems/aws-sdk-core-3.6.0/lib/seahorse/client/request.rb:70:in `send_request’ from /var/lib/jenkins/.gem/ruby/gems/aws-sdk-s3-1.4.0/lib/aws-sdk-s3/client.rb:3980:in `list_parts’ … The options passed to list_parts must not include “server_side_encryption”. I always forget to remove this parameter. A good way that I have […]

  • Puppet deprecation in stdlib module…

    As part of the long upgrade to become fully compatible with puppet 4 and drop puppet 3 support — version 4.13+ of the stdlib module introduced some breaking changes for other modules that I use. I recently upgrade some individual modules using the ‘puppet module upgrade’ method. Upon upgrading, I received the following message: Error: […]

  • Throttling Requests with the Ruby aws-sdk

    A common problem of late is throttling requests when using the ruby aws-sdk gem to access AWS services. Handling these exceptions is fairly trivial with a while loop like the following: retry_count = 0 retry_success = 0 while retry_success == 0 retry_success = 1 begin # # enter code to interact with AWS here # […]

  • Multipart uploads to s3 using aws-sdk v2 for ruby…

    The Ruby guys over at AWS have done a great job at explaining file uploads to S3 but they left out how to perform multipart uploads citing reservation over “advanced use cases“. Prerequisites: identify an S3 bucket to upload a file to — use an existing bucket or create a new one create or identify […]