Displaying 3 results from an estimated 3 matches for "clientvariation".
2006 May 19
1
Need help with a test
Hi,
I have this controller method that I need to test:
def link_concept_to_client
concept_to_link = Concept.find(params[:concept_id])
# take all the variations for the concept
for variation in concept_to_link.variations
new_client_variation = ClientVariation.new
new_client_variation.client = session[:active_client]
new_client_variation.variation = variation
new_client_variation.name_fr = variation.name_fr
new_client_variation.name_en = variation.name_en
new_client_variation.save
end
flash[:notice] = "Concept l...
2006 May 17
0
teardown not cleaning the BD?
...were I add/delete
records on top of the ones provided in the fixture and it seems like the
records are surviving the teardown. Isnt teardown supposed to be ran
after each test? So if I have something like:
def teardown
Client.delete_all
Concept.delete_all
Variation.delete_all
ClientVariation.delete_all
end
All the records from my DB should be deleted...
Well, when I run my test, I get a faillure on a test that is supposed to
make sure that a specific record is deleted. When I look at the DB, the
record is still there.
The test goes like this:
def test_delete_concept
#make...
2006 May 20
3
Navigation between DB Items with active Record
...lot of stuff without it but I decided that I need to
learn how it works this weekend! So I need your help to figure that
out...
I have the following 4 models:
class Client < ActiveRecord::Base
has_many :client_variations
has_many :variations, :through => :client_variations
end
class ClientVariation < ActiveRecord::Base
belongs_to :client
belongs_to :variation
end
class Variation < ActiveRecord::Base
belongs_to :concept
has_many :client_variations, :dependent => :destroy
end
class Concept < ActiveRecord::Base
has_many :variations, :order =>"id", :dependen...