mercredi 29 juin 2016

how can i do images download through polymorphic connection with refile gem on rails 3?

i have images table with images_type - string

here s model of it:

class Image < ActiveRecord::Base
 belongs_to :imageable, :polymorphic => true
end

which is connected to users

class User < ActiveRecord::Base
 has_many :images, :as => :imageable
 accepts_nested_attributes_for :images

 attachment :profile_image

 attr_accessible :profile_image
...
end

schema.rb:

create_table "images", :force => true do |t|
 t.string   "image_type"
 t.datetime "created_at", :null => false
 t.datetime "updated_at", :null => false
end

atm images can be downloaded by refile gem by default settings of it - in a :profile_image

how can i download it on :image_type field?

Aucun commentaire:

Enregistrer un commentaire