lib/pgcrypto/column.rb in pgcrypto-0.3.5 vs lib/pgcrypto/column.rb in pgcrypto-0.3.6
- old
+ new
@@ -1,12 +1,15 @@
module PGCrypto
class Column < ActiveRecord::Base
- attr_accessible :name
+
+ attr_accessible :name if respond_to? :attr_accessible
+
self.table_name = 'pgcrypto_columns'
+
before_save :set_owner_table
belongs_to :owner, :autosave => false, :inverse_of => :pgcrypto_columns, :polymorphic => true
- default_scope select(%w(id owner_id owner_type owner_table))
+ default_scope { select(%w(id owner_id owner_type owner_table)) }
protected
def set_owner_table
self.owner_table = self.owner.class.table_name
end