Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions db/migrate/20120612112526_create_attachinary_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/attachinary/orm/file_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/attachinary/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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=)
Expand Down