From c102e81b031902fe3bc3eee2c063a5e083b95923 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 24 Aug 2010 16:56:04 -0700 Subject: [PATCH] put the visible back in --- app/helpers/groups_helper.rb | 6 ++++++ app/models/user.rb | 2 +- app/views/layouts/application.html.haml | 2 +- spec/models/album_spec.rb | 11 +++++------ 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 app/helpers/groups_helper.rb diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb new file mode 100644 index 000000000..a0e7d95c6 --- /dev/null +++ b/app/helpers/groups_helper.rb @@ -0,0 +1,6 @@ +module GroupsHelper + def link_for_group( group ) + puts request.params + link_to group.name, group + end +end diff --git a/app/models/user.rb b/app/models/user.rb index dddc975cb..33073f701 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,7 +8,7 @@ class User key :friend_ids, Array key :pending_request_ids, Array - key :_post_ids, Array + key :visible_post_ids, Array one :person, :class_name => 'Person', :foreign_key => :owner_id diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ac6d76810..174e08f93 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -63,7 +63,7 @@ %li= link_to "All Groups", root_url - for group in @groups %li{:class => ("selected" if current_group?(group))} - = link_to group.name, group + = link_for_group group %li.new_group= link_to("new", "#add_group_pane", :id => "add_group_button") .yo{ :style => "display:none;"} diff --git a/spec/models/album_spec.rb b/spec/models/album_spec.rb index f1d40dd90..969318f43 100644 --- a/spec/models/album_spec.rb +++ b/spec/models/album_spec.rb @@ -5,14 +5,14 @@ describe Album do @fixture_name = File.dirname(__FILE__) + '/../fixtures/button.png' @user = Factory.create(:user) @user.person.save - @album = Album.new(:name => "test collection", :person => @user.person) + @group = @user.group(:name => "Foo") + @album = @user.post(:album, :name => "test collection", :to => @group.id) end it 'should belong to a person' do @album.person = nil @album.valid?.should be false - person = Factory.create(:person) - @album.person = person + @album.person = Factory.create(:person) @album.valid?.should be true @album.save person.albums.count.should == 1 @@ -27,11 +27,10 @@ describe Album do end it 'should contain photos' do - album = Album.create(:name => "test collection", :person => @user.person) photo = Factory.build(:photo, :person => @user.person) - album.photos << photo - album.photos.count.should == 1 + @album.photos << photo + @album.photos.count.should == 1 end it 'should remove all photos on album delete' do