Note that there are some explanatory texts on larger screens.

plurals
  1. POCarrierWave. Impossible to save the file with STI
    text
    copied!<p>I have model <code>Document</code>:</p> <pre><code>class Document &lt; ActiveRecord::Base belongs_to :company validates :name, :presence =&gt; true end </code></pre> <p>And two classes inherited from <code>Document</code>:</p> <p><code>License</code>:</p> <pre><code>class License &lt; Document mount_uploader :file, DocumentUploader end </code></pre> <p>And <code>Certificate</code></p> <pre><code>class Certificate &lt; Document mount_uploader :file, DocumentUploader end </code></pre> <p>And when I try to do <code>current_company.licenses.create(...)</code> or same action for the certificate, always all params are saved, besides <code>file</code>, which always is <code>nil</code></p> <p>Also I've tried to mount <code>file</code> inside of <code>Document</code> model... Help me please.</p> <p>Here is logs:</p> <pre><code>Started POST "/companies/1/verified" for 127.0.0.1 at Mon Mar 19 09:33:41 +0200 2012 Processing by CompaniesController#verified as HTML Parameters: {"verified"=&gt;{"certificate"=&gt;{"name"=&gt;"Certificate", "file"=&gt;"test.png"}, "insured"=&gt;"2000000", "suppliers"=&gt;"", "license"=&gt;{"name"=&gt;"License", "file"=&gt;"test.png"}}, "authenticity_token"=&gt;"0hIn41Tjonm/AXZBKM1PE/tjQxJDLqZaojMTHDoZq2k=", "id"=&gt;"1", "utf8"=&gt;"✓", "commit"=&gt;"Update verifications"} Company Load (0.7ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = 1 LIMIT 1 (0.1ms) BEGIN SQL (0.8ms) INSERT INTO "documents" ("company_id", "created_at", "file", "name", "type", "updated_at", "verified") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["company_id", 1], ["created_at", Mon, 19 Mar 2012 07:33:41 UTC +00:00], ["file", nil], ["name", "License"], ["type", "License"], ["updated_at", Mon, 19 Mar 2012 07:33:41 UTC +00:00], ["verified", false]] (0.6ms) COMMIT (0.1ms) BEGIN SQL (0.5ms) INSERT INTO "documents" ("company_id", "created_at", "file", "name", "type", "updated_at", "verified") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["company_id", 1], ["created_at", Mon, 19 Mar 2012 07:33:41 UTC +00:00], ["file", nil], ["name", "Certificate"], ["type", "Certificate"], ["updated_at", Mon, 19 Mar 2012 07:33:41 UTC +00:00], ["verified", false]] (0.4ms) COMMIT Redirected to http://localhost:3000/company/profile Completed 302 Found in 18ms (ActiveRecord: 3.3ms) </code></pre> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload