Welcome to the Archives

on Sunday, April 23rd, 2017

Update: I’m now blogging at https://ashlynnpai.github.io/journal/. Please visit me there. *** Although I’m no longer maintaining this blog, I plan to leave it up for the foreseeable future in case the code snippets and tutorials are of use to anyone. If I have time to write more tutorials they will be in a separate blog […]

Testing an Uploaded Image With RSpec

on Sunday, July 17th, 2016

I had some initial difficulty testing my photos controller with an uploaded file for the :image field, because the test was reading :image as nil. What worked was wrapping the image in a content wrapper using Class: Rack::Test::UploadedFile. I have this implemented in my factory: image { Rack::Test::UploadedFile.new(File.open(File.join(Rails.root, ‘/spec/support/my_image.jpg’)), ‘image/jpeg’) } The image file “my_image.jpg” […]

Customizing Strong Parameters

on Sunday, July 10th, 2016

I’m working on a Rails app to allow users to post information on places they want to go to and then add the places to their personal bucket lists. While the strong parameters for the create and update actions can commonly be shared, I wanted to set different permitted parameters for the create and update […]

Next Page »