From b0ffd85326fa05cb313e7bbe52e90715f77a8ca1 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Mon, 25 Feb 2013 23:07:47 +0000 Subject: [PATCH] Stringify gardens as their names. --- app/models/garden.rb | 3 +++ spec/models/garden_spec.rb | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/app/models/garden.rb b/app/models/garden.rb index ecacfc17f..8edbbda0b 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -27,7 +27,10 @@ class Garden < ActiveRecord::Base end return unique_plantings[0..3] + end + def to_s + name end end diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb index 4a01f43d3..2527ea7f9 100644 --- a/spec/models/garden_spec.rb +++ b/spec/models/garden_spec.rb @@ -18,6 +18,10 @@ describe Garden do @garden.owner.should be_an_instance_of Member end + it "should stringify as its name" do + @garden.to_s.should == @garden.name + end + context "featured plantings" do before :each do @tomato = FactoryGirl.create(:tomato)