Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to remove carrierwave auto generated json
    primarykey
    data
    text
    <p>I am using jquery-file-upload to upload avatar image file to carrierwave with rails.</p> <p>The controller:</p> <pre><code>class Api::V1::AvatarsController &lt; ApplicationController load_and_authorize_resource :user load_and_authorize_resource :avatar, through: :user respond_to :json def create @avatar.active = true @avatar.save respond_with @avatar, location: nil end end </code></pre> <p>I also use active_model_serializers to generate json:</p> <pre><code>class AvatarSerializer &lt; ApplicationSerializer attributes :active attributes :image attributes :crop_x attributes :crop_y attributes :crop_w attributes :crop_h attributes :image_medium_path attributes :image_large_path attributes :can_manage attributes :user_id def image_medium_path object.image_url :medium end def image_large_path object.image_url :large end def can_manage Ability.new(scope).can?(:manage, object) end end </code></pre> <p>After I upload avatar image using jquery-file-upload, I got response:</p> <pre><code> {"avatar":{ "id":"51eba3143803f8aa7c000009", "active":true, *"image":{ "image":{ "url":"...", "large":{ "url":"..." }, "medium":{ "url":"..." }, "small":{ "url":"..." }, "xsmall":{ "url":"..." }, "xxsmall":{ "url":"..." } } },* "crop_x":0,"crop_y":0,"crop_w":294,"crop_h":294,"image_medium_path":"...","image_large_path":"...","can_manage":true,"user_id":"51e4156a3803f8cde900000b"}} </code></pre> <p>As you can see the "image" section of json is carriverwave added part. I want to delete it. how to do it? Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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