Displaying 3 results from an estimated 3 matches for "client_variation".
Did you mean:
client_variations
2006 May 20
3
Navigation between DB Items with active Record
...without using <find_by_sql> or other ugly tricks. So far, I have
managed to do a 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 &...
2006 May 17
0
teardown not cleaning the BD?
...there.
The test goes like this:
def test_delete_concept
#make sure the concept record is present
assert_not_nil Concept.find(concepts(:entreprise).id)
#make sure the variations record is present
assert_not_nil Variation.find_by_concept_id
(concepts(:entreprise).id)
#find a client_variation
first_variation = Variation.find_by_concept_id
(concepts(:entreprise).id, :limit => 1)
#make sure it is present
assert_not_nil ClientVariation.find_by_variation_id
(first_variation.id)
#delete the record from the DB
get :delete_concept, {:concept_id => concepts(:entrepri...
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]...