search for: attachment_file_name

Displaying 3 results from an estimated 3 matches for "attachment_file_name".

2012 Jan 19
0
Problem in testing with separate validation of :attachment_file_name
Using: RSpec, Shoulda, Paperclip (including matchers) Example Model class Example < ActiveRecord::Base has_attached_file :attachment validates_attachment_presence :attachment validates_format_of :attachment_file_name, :with => /\.(png|jpe?g)$/ end Example Test require ''spec/helper'' describe Example do it { should validate_attachment_presence(:attachment) } it { should validate_format_of(:attachment_file_name). with(''example.png'') } it { should validate...
2009 Sep 03
12
paperclip is not saving the files
...model has has_attached_file :attachment,:styles => { :medium => "300x300>", :thumb => "100x100>" } and i have db migration as class AddAttachmentToPolicies < ActiveRecord::Migration def self.up add_column :policies, :attachment_file_name, :string add_column :policies, :attachment_content_type, :string add_column :policies, :attachment_file_size, :integer end def self.down remove_column :policies, :attachment_file_name remove_column :policies, :attachment_content_type remove_column :policies, :attachment_fil...
2009 Aug 07
2
paperclip model fails while when updating with no attachment
...with no attachment yields the following error: "ActiveRecord::RecordInvalid in ItemsController#update Validation failed: Attachment file name can''t be blank, Attachment file size can''t be blank" There are validation errors from the Assets Model for the presence of :attachment_file_name and :attachment_file_size. I have the below code in my item model: [code] after_save create_or_update_assets! def create_or_update_assets! # return if there are no asset_attributes return true if asset_attributes.nil? || asset_attributes.empty? # pull the attributes from the ins...