Skip to content

Commit

Permalink
Give artifact_version a has_one to get to its cloud_profile.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Crawley committed Jan 13, 2011
1 parent 6b6561e commit 9b9f832
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/models/artifact_version.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class ArtifactVersion < ActiveRecord::Base


belongs_to :artifact belongs_to :artifact
has_many :deployments, :dependent => :destroy has_many :deployments, :dependent => :destroy

has_one :cloud_profile, :through => :artifact

before_create :assign_version_number before_create :assign_version_number
after_create :upload! after_create :upload!
# This before_destroy must come before has_attached_file # This before_destroy must come before has_attached_file
Expand Down
5 changes: 2 additions & 3 deletions spec/models/artifact_version_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
artifact_version.save! artifact_version.save!
end end


it "should belong to an artifact" do it { should belong_to :artifact }
ArtifactVersion.new.should respond_to(:artifact) it { should have_one(:cloud_profile).through(:artifact) }
end


it "should assign a version number before creating" do it "should assign a version number before creating" do
artifact_version = ArtifactVersion.new(@valid_attributes) artifact_version = ArtifactVersion.new(@valid_attributes)
Expand Down

0 comments on commit 9b9f832

Please sign in to comment.