Skip to content

Instantly share code, notes, and snippets.

@marklocklear
Created November 23, 2011 19:48
Show Gist options
  • Select an option

  • Save marklocklear/1389697 to your computer and use it in GitHub Desktop.

Select an option

Save marklocklear/1389697 to your computer and use it in GitHub Desktop.
Loading development environment (Rails 3.0.5)
ruby-1.9.2-head :001 > r = Rubric.first
=> #<Rubric id: 1, name: "Computer Technology", section_id: 2, created_at: "2011-10-18 13:53:24", updated_at: "2011-11-23 19:33:24", competency: "">
ruby-1.9.2-head :002 > r.indicators
=> [#<Indicator id: 1, rubric_id: 1, name: "Present info professionally", created_at: "2011-10-18 13:53:24", updated_at: "2011-10-18 13:53:24">, #<Indicator id: 6, rubric_id: 1, name: "test2", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">]
ruby-1.9.2-head :003 > r.questions
=> [#<Question id: 1, indicator_id: 1, name: "Choosed the correct software", created_at: "2011-10-18 13:53:24", updated_at: "2011-10-18 13:53:24">, #<Question id: 7, indicator_id: 1, name: "test", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">, #<Question id: 8, indicator_id: 6, name: "q2", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">]
ruby-1.9.2-head :004 > klone = r.clone :include => {:indicators => :questions}
=> #<Rubric id: nil, name: "Computer Technology", section_id: 2, created_at: "2011-10-18 13:53:24", updated_at: "2011-11-23 19:33:24", competency: "">
ruby-1.9.2-head :005 > klone
=> #<Rubric id: nil, name: "Computer Technology", section_id: 2, created_at: "2011-10-18 13:53:24", updated_at: "2011-11-23 19:33:24", competency: "">
ruby-1.9.2-head :006 > klone.indicators
=> [#<Indicator id: nil, rubric_id: nil, name: "Present info professionally", created_at: "2011-10-18 13:53:24", updated_at: "2011-10-18 13:53:24">, #<Indicator id: nil, rubric_id: nil, name: "test2", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">]
ruby-1.9.2-head :007 > klone.questions
=> []
ruby-1.9.2-head :008 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment