Commit 7a3079c
Changed files (2)
lib
humble
spec
integration
lib/humble/column.rb
@@ -52,8 +52,10 @@ module Humble
@type = type
end
- def apply(id, entity)
- #entity.public_send("#{column_name}=", id)
+ def apply(value, entity)
+ child_entity = @type.new
+ column = column_name.to_s.gsub(/_id/, '')
+ entity.public_send("#{column}=", child_entity)
end
def prepare(entity)
spec/integration/select_spec.rb
@@ -37,7 +37,7 @@ describe "select items" do
expect(result).to be_instance_of(Movie)
expect(result.id).to eql(movie_id)
expect(result.name).to eql('blood in, blood out')
- #expect(result.studio).to be_instance_of(Studio)
+ expect(result.studio).to be_instance_of(Studio)
end
end
end