title: Rails 6 Production Active Storage NoMethodError (undefined method `name' for nil:NilClass)
body: <p>I have issue when try to attach image using Active Storage
  It passed on development mode, but fail in production mode.</p>
  <p>Details as below:</p>
  <p>Model:</p>
  <pre><code>class Post &lt; ApplicationRecord
      extend FriendlyId
      friendly_id :title, use: :slugged
      
      validates :title, presence: true
      
      has_many :post_comments, dependent: :destroy
  
      has_one_attached :wall_picture
      
      # validates :content_rich_text, presence: true
      has_rich_text :content_rich_text
      
      def self.approved
        where(approved: :true)
      end
  end
  </code></pre>
  <p>Controller:</p>
  <pre><code>def create
          @post = Post.new(post_param)
          @post.save!
          redirect_to posts_path
     end
  private
      # define param for each post
      def post_param
          params.require(:post).permit(:id, :wall_picture, :title, :content_rich_text)
      end
  </code></pre>
  <p>Storage config:</p>
  <pre><code>google:
      service: GCS
      project: pet-app
      credentials: &lt;%= Rails.root.join(&quot;config/pet-app-google-storage-key.json&quot;) %&gt;
      bucket: pet-app
  </code></pre>
  <p>Log in development(create oject success):</p>
  <pre><code>Processing by PostsController#create as HTML
    Parameters: {&quot;authenticity_token&quot;=&gt;&quot;IssIp0Mhh90gl9pwuuDfMdrCYz5Rf6gxMlv/WbTe6dAWye25eWAMjfhp135CqGlZj6bCYgvslQHX75yoyn/Sqw==&quot;, &quot;post&quot;=&gt;{&quot;wall_picture&quot;=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x00007f05559da830 @tempfile=#&lt;Tempfile:/tmp/RackMultipart20210328-169-j5mnl3.jpg&gt;, @original_filename=&quot;cover_building.jpg&quot;, @content_type=&quot;image/jpeg&quot;, @headers=&quot;Content-Disposition: form-data; name=\&quot;post[wall_picture]\&quot;; filename=\&quot;cover_building.jpg\&quot;\r\nContent-Type: image/jpeg\r\n&quot;&gt;, &quot;title&quot;=&gt;&quot;Test new post&quot;, &quot;content_rich_text&quot;=&gt;&quot;&quot;}, &quot;commit&quot;=&gt;&quot;Gửi nội dung&quot;}
    TRANSACTION (0.2ms)  BEGIN
    ↳ app/controllers/posts_controller.rb:13:in `create'
    Post Exists? (0.8ms)  SELECT 1 AS one FROM &quot;posts&quot; WHERE &quot;posts&quot;.&quot;id&quot; IS NOT NULL AND &quot;posts&quot;.&quot;slug&quot; = $1 LIMIT $2  [[&quot;slug&quot;, &quot;test-new-post&quot;], [&quot;LIMIT&quot;, 1]]
    ↳ app/controllers/posts_controller.rb:13:in `create'
    Post Create (3.7ms)  INSERT INTO &quot;posts&quot; (&quot;title&quot;, &quot;created_at&quot;, &quot;updated_at&quot;, &quot;slug&quot;) VALUES ($1, $2, $3, $4) RETURNING &quot;id&quot;  [[&quot;title&quot;, &quot;Test new post&quot;], [&quot;created_at&quot;, &quot;2021-03-28 09:57:04.803702&quot;], [&quot;updated_at&quot;, &quot;2021-03-28 09:57:04.803702&quot;], [&quot;slug&quot;, &quot;test-new-post&quot;]]
  </code></pre>
  <p>Log in Production( i'm using Digital Ocean Droplet with Ubuntu 20.04)</p>
  <pre><code>Processing by PostsController#create as HTML
    Parameters: {&quot;authenticity_token&quot;=&gt;&quot;d1OTNiyXbvamUEUUUfc9hL1x1Biyh/bJf8NFz99HkTnXNIohTUsn4alNeimiR4o/syG7/NpKCvoSufbVaCp/+A==&quot;, &quot;post&quot;=&gt;{&quot;wall_picture&quot;=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x0000563231456050 @tempfile=#&lt;Tempfile:/tmp/RackMultipart20210328-32996-ott8bf.jpg&gt;, @original_filename=&quot;cover_building.jpg&quot;, @content_type=&quot;image/jpeg&quot;, @headers=&quot;Content-Disposition: form-data; name=\&quot;post[wall_picture]\&quot;; filename=\&quot;cover_building.jpg\&quot;\r\nContent-Type: image/jpeg\r\n&quot;&gt;, &quot;title&quot;=&gt;&quot;Test new post&quot;, &quot;content_rich_text&quot;=&gt;&quot;&quot;}, &quot;commit&quot;=&gt;&quot;Gửi nội dung&quot;}
  Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.0ms | Allocations: 934)
  
  **NoMethodError (undefined method `name' for nil:NilClass):**
  </code></pre>
  <p>app/controllers/posts_controller.rb:12:in `create'</p>
  <p>Can some one help me known why I get this problem in production and how to solve it? Thank you so much!</p>