diff --git a/db/migrate/20120612112526_create_attachinary_tables.rb b/db/migrate/20120612112526_create_attachinary_tables.rb index 09aa11c7..46581f06 100644 --- a/db/migrate/20120612112526_create_attachinary_tables.rb +++ b/db/migrate/20120612112526_create_attachinary_tables.rb @@ -8,6 +8,7 @@ def change t.string :version t.integer :width t.integer :height + t.integer :pages t.string :format t.string :resource_type t.timestamps diff --git a/lib/attachinary/orm/file_mixin.rb b/lib/attachinary/orm/file_mixin.rb index e7628a37..58d82866 100644 --- a/lib/attachinary/orm/file_mixin.rb +++ b/lib/attachinary/orm/file_mixin.rb @@ -3,14 +3,14 @@ module FileMixin def self.included(base) base.validates :public_id, :version, :resource_type, presence: true if Rails::VERSION::MAJOR == 3 - base.attr_accessible :public_id, :version, :width, :height, :format, :resource_type + base.attr_accessible :public_id, :version, :width, :height, :format, :resource_type, :pages, :raw_convert end base.after_destroy :destroy_file base.after_create :remove_temporary_tag end def as_json(options) - super(only: [:id, :public_id, :format, :version, :resource_type], methods: [:path]) + super(only: [:id, :public_id, :format, :version, :resource_type, :pages, :raw_convert], methods: [:path]) end def path(custom_format=nil) diff --git a/lib/attachinary/utils.rb b/lib/attachinary/utils.rb index d3c92452..66fcfb05 100644 --- a/lib/attachinary/utils.rb +++ b/lib/attachinary/utils.rb @@ -14,7 +14,7 @@ def self.process_hash(hash, scope=nil) file = if Rails::VERSION::MAJOR == 3 Attachinary::File.new hash.slice(*Attachinary::File.attr_accessible[:default].to_a) else - permitted_params = ActionController::Parameters.new(hash).permit(:public_id, :version, :width, :height, :format, :resource_type) + permitted_params = ActionController::Parameters.new(hash).permit(:public_id, :version, :width, :height, :format, :resource_type, :pages, :raw_convert) Attachinary::File.new(permitted_params) end file.scope = scope.to_s if scope && file.respond_to?(:scope=)