Commit bc7d6b4f
Changed files (3)
app
controllers
models
app/controllers/creations_controller.rb
@@ -28,8 +28,7 @@ class CreationsController < ApplicationController
@creation.photos.build({:image => params[:photo]})
if @creation.save
- #redirect_to(@creation, :notice => 'Creation was successfully cropped.')
- redirect_to(creations_url)
+ redirect_to(creations_url, :notice => 'Your creation will show up in the main timeline shortly.')
else
flash[:error] = @creation.errors.full_messages
render :action => "new"
app/models/creation.rb
@@ -1,17 +1,11 @@
class Creation < ActiveRecord::Base
acts_as_commentable
validates :name, :presence => true
- #validates :image, :presence => true
- #attr_accessible :user_id, :story, :name, :image, :remote_image_url, :category_ids, :is_restricted, :watermark
attr_accessible :user_id, :story, :name, :category_ids, :is_restricted, :watermark
belongs_to :user
has_and_belongs_to_many :categories, :join_table => 'creations_categories', :uniq => true, :autosave => true
has_many :photos, :dependent => :destroy
has_many :favorites, :dependent => :destroy
- #mount_uploader :image, ImageUploader
-
- attr_accessor :crop_x, :crop_y, :crop_h, :crop_w
- #after_update :reprocess_image, :if => :cropping?
default_scope order("created_at DESC")
@@ -19,19 +13,6 @@ class Creation < ActiveRecord::Base
story.split[0...50].join(' ') + '...'
end
- def cropping?
- !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
- end
-
- #def reprocess_image
- #begin
- #self.image.recreate_versions!
- #rescue Exception => e
- #logger.error e.message
- #logger.error e.backtrace.inspect
- #end
- #end
-
def is_owned_by(user)
@user == user
end
app/models/photo.rb
@@ -3,6 +3,20 @@ class Photo < ActiveRecord::Base
belongs_to :creation
validates :image, :presence => true
mount_uploader :image, PhotoUploader
+ #attr_accessor :crop_x, :crop_y, :crop_h, :crop_w
+ #after_update :reprocess_image, :if => :cropping?
after_save :enqueue
+
+ #def reprocess_image
+ #begin
+ #self.image.recreate_versions!
+ #rescue Exception => e
+ #logger.error e.message
+ #logger.error e.backtrace.inspect
+ #end
+ #end
+ #def cropping?
+ #!crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
+ #end
end