I have:

treatments.yml

treatment3:
  id: 3
  code: T3
  description: "Desarrollo de una política de seguridad"
  reduction: 0.3
  document: "D01_Politica_Seguridad"
  account_id: 1
  soa_lines: soa_line3
treatment4:
  id: 4
  code: T1
  description: "Inclusión en el mantenimiento de los sistemas un chequeo
de la seguridad del navegador en uso."
  reduction: 0.1
  document: "D10_Mantenimiento_Equipos.docx"
  account_id: 2
  soa_lines: soa_line4

and:

soa_lines.yml

soa_line3:
  account_id: 1
  id: 3
  justification: "La política de seguridad es fundamental para el
funcionamiento del sistema"
  control_id: 3
  applicability: true
soa_line4:
  account_id: 2
  id: 4
  justification: "Es necesario proteger las transacciones en línea que
realiza la organización"
  control_id: 1
  applicability: true
  treatments: treatment4

And both models have:

treatment.rb

has_and_belongs_to_many :soa_lines

soa_line.rb

has_and_belongs_to_many :treatments

But when I try to access to treatment.soa_lines it returns nothing:

  test "successful treatment modification" do
    treatment = treatments(:treatment4)

    puts "Id", treatment.id
    puts "Code", treatment.code
    puts "Description", treatment.description
    puts "Reduction", treatment.reduction
    puts "Account", treatment.account.name
    puts "Soa Lines", treatment.soa_lines

All puts return correct values but treatment.soa_lines is []

What I'm doing wrong? What can I check to correct this?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to