<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rails on Nicholas Shirley</title><link>https://nicholasshirley.com/tags/Rails/</link><description>Recent content in Rails on Nicholas Shirley</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 09 May 2019 09:04:42 +0000</lastBuildDate><atom:link href="https://nicholasshirley.com/tags/Rails/index.xml" rel="self" type="application/rss+xml"/><item><title>Verify That an ActiveRecord Object has at Least One Attribute</title><link>https://nicholasshirley.com/verify-that-an-activerecord-object-has-at-least-one-attribute/</link><pubDate>Thu, 09 May 2019 09:04:42 +0000</pubDate><guid>https://nicholasshirley.com/verify-that-an-activerecord-object-has-at-least-one-attribute/</guid><description>&lt;p&gt;Rails ActiveRecord callbacks make validation a breeze, but what happens if you want to verify that a record has at least one attribute present, but you don&amp;rsquo;t care which attribute it is? This was a recent case I was working on for a client who was having their operators fill in a form with a lot of uncertainty. They couldn&amp;rsquo;t know which record would be needed, but we didn&amp;rsquo;t want to allow all records to be blank.&lt;/p&gt;</description></item><item><title>Re-associate ActiveStorage attachments after changing a table name</title><link>https://nicholasshirley.com/re-associate-activestorage-attachments-after-changing-a-table-name/</link><pubDate>Thu, 26 Apr 2018 13:51:52 +0000</pubDate><guid>https://nicholasshirley.com/re-associate-activestorage-attachments-after-changing-a-table-name/</guid><description>Sometimes you have to change a table name. When you do, don&amp;rsquo;t forget to update ActiveStorage relationships otherwise your files will be orphaned.</description></item><item><title>Deleting ActiveStorage Attachments From the Controller, 3 Ways</title><link>https://nicholasshirley.com/several-strategies-to-delete-activestorage-attachments/</link><pubDate>Thu, 19 Apr 2018 20:04:41 +0000</pubDate><guid>https://nicholasshirley.com/several-strategies-to-delete-activestorage-attachments/</guid><description>ActiveStorage in Rails 5.2 is awesome, but where do handle deleting attachments on the controller? Here are some possible options.</description></item><item><title>Retrieve Associated Parent Attributes from Child Record in Rails</title><link>https://nicholasshirley.com/retrieve-associated-parent-attributes-from-child-record-in-rails/</link><pubDate>Fri, 13 Apr 2018 12:44:05 +0000</pubDate><guid>https://nicholasshirley.com/retrieve-associated-parent-attributes-from-child-record-in-rails/</guid><description>Calling attributes of associated records isn&amp;rsquo;t &amp;ldquo;directional&amp;rdquo;. Or, how I learned to stop worrying and love foreign keys.</description></item><item><title>Error Better: Effectively Utilize Active Model Errors with Rails in API Mode</title><link>https://nicholasshirley.com/error-better/</link><pubDate>Mon, 26 Mar 2018 08:39:54 +0000</pubDate><guid>https://nicholasshirley.com/error-better/</guid><description>Go beyond delivering just full_messages in Rails to send well formatted error messages using Rails API</description></item><item><title>Using Font Awesome 5 in the Rails Asset Pipeline with Turbolinks</title><link>https://nicholasshirley.com/using-font-awesome-5-and-the-rails-asset-pipeline/</link><pubDate>Mon, 26 Feb 2018 20:05:26 +0000</pubDate><guid>https://nicholasshirley.com/using-font-awesome-5-and-the-rails-asset-pipeline/</guid><description>Want to use Font Awesome 5 with the Rails Asset Pipeline and Turbolinks? Read on to find out what you need.</description></item><item><title>User authorization without cancan(can)</title><link>https://nicholasshirley.com/cancan-cant/</link><pubDate>Wed, 21 Feb 2018 18:42:27 +0000</pubDate><guid>https://nicholasshirley.com/cancan-cant/</guid><description>Building custom user authorization that integrates into Devise&amp;rsquo;s current_user helper.</description></item></channel></rss>