Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I disable Attachment Fu Plugin in Community Engine without removing it?
    primarykey
    data
    text
    <p>So here is the situation:</p> <p>The Photo model in Community Engine is using attachment Fu. I, wish to use paperclip instead. </p> <p>Now this works fine until I have to delete an attachment. That's when the attachment Fu is causing the problem. Here is what Photo.rb looks like (in /vendor/plugins/community_engine/app/models):</p> <pre><code>class Photo &lt; ActiveRecord::Base acts_as_commentable belongs_to :album has_attachment prepare_options_for_attachment_fu(AppConfig.photo['attachment_fu_options']) acts_as_taggable acts_as_activity :user, :if =&gt; Proc.new{|record| record.parent.nil? &amp;&amp; record.album_id.nil?} validates_presence_of :size validates_presence_of :content_type validates_presence_of :filename validates_presence_of :user, :if =&gt; Proc.new{|record| record.parent.nil? } validates_inclusion_of :content_type, :in =&gt; attachment_options[:content_type], :message =&gt; "is not allowed", :allow_nil =&gt; true validates_inclusion_of :size, :in =&gt; attachment_options[:size], :message =&gt; " is too large", :allow_nil =&gt; true ... ... end </code></pre> <p>So my question is: Is there a way to disable this plugin? I don't want to change photo.rb and delete any lines, nor do I want to remove the plugin.</p> <p>Any ideas here?</p> <p>New Photo Model (in /app/):</p> <pre><code>require 'paperclip_processors/cropper' class Photo &lt; ActiveRecord::Base attr_accessible :image has_attached_file :image, :path=&gt;":class/:hash/:style.:extension", :styles =&gt; { :thumb =&gt; {:geometry =&gt; "100x100!", :crop_to =&gt; :crop_parameters}, :medium =&gt; {:geometry =&gt; "290x320!", :crop_to =&gt; :crop_parameters}, :large =&gt; {:geometry =&gt; "664&gt;", :crop_to =&gt; :crop_parameters}, :uncropped =&gt; "630x472" }, :convert_options=&gt;'-quality 92', :processors =&gt; [:cropper] def crop_parameters ActiveSupport::JSON.decode(read_attribute(:crop_parameters)) rescue nil end # overrides to make paperclip appear as attachment_fu to existing pages def size # in MB image_file_size end def filename image_file_name end def content_type image_content_type end def public_filename(size=:original) image.url(size) || "" end end </code></pre> <p>New Photo Controller (in /app/):</p> <pre><code>require 'pp' class PhotosController &lt; BaseController before_filter :use_paperclip, :only =&gt; [:create] def use_paperclip params[:photo][:image] = params[:photo][:uploaded_data] params[:photo].delete(:uploaded_data) end end </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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