Permalink
Browse files

set_table_name ist deprecated

  • Loading branch information...
1 parent b144212 commit 3cb0637191aeea07d252fb44c4665c6521196e3e @TeaMoe TeaMoe committed Feb 15, 2012
Showing with 15 additions and 17 deletions.
  1. +1 −1 lib/digineo/image.rb
  2. +7 −8 lib/digineo/image_gallery.rb
  3. +7 −8 lib/digineo/image_type.rb
View
2 lib/digineo/image.rb
@@ -1,7 +1,7 @@
#require 'RMagick'
class Digineo::Image < ActiveRecord::Base
- set_table_name :digineo_images
+ self.table_name = :digineo_images
store_full_sti_class = true
belongs_to :parentmodel, :polymorphic => true
View
15 lib/digineo/image_gallery.rb
@@ -1,17 +1,16 @@
class Digineo::ImageGallery < ActiveRecord::Base
-
- set_table_name :digineo_image_galleries
-
+
+ self.table_name = :digineo_image_galleries
+
belongs_to :parentmodel, :polymorphic => true
has_many :images, :class_name => 'Digineo::Image', :foreign_key => :gallery_id
- has_one :avatar, :foreign_key => :gallery_id, :class_name => "Digineo::Image"
-
-
+ has_one :avatar, :foreign_key => :gallery_id, :class_name => "Digineo::Image"
+
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:parentmodel_id, :parentmodel_type]
-
+
def create_image_by_url(url, image_type = nil)
images.create!(:file_url => url, :parentmodel => parentmodel, :image_type => image_type)
end
-
+
end
View
15 lib/digineo/image_type.rb
@@ -1,14 +1,13 @@
-class Digineo::ImageType < ActiveRecord::Base
- set_table_name :digineo_image_types
-
+class Digineo::ImageType < ActiveRecord::Base
+ self.table_name = :digineo_image_types
+
has_many :images, :class_name => "Digineo::Image"
-
+
validates_presence_of :name
validates_uniqueness_of :name
-
-end
+end
class Digineo::ImageType::Exception < Exception
-
-end
+
+end

0 comments on commit 3cb0637

Please sign in to comment.