Skip to content

Commit

Permalink
Merge branch 'edge' into bill_merge
Browse files Browse the repository at this point in the history
Conflicts:

	app/views/people/_wall.html.erb
  • Loading branch information
mhartl committed Sep 29, 2008
2 parents 7f1bcd3 + 3bcfe7a commit b9639fe
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 111 deletions.
5 changes: 5 additions & 0 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ class ActivitiesController < ApplicationController

before_filter :authorize_user, :only => :destroy

# This gets called after activity destruction for some reason.
def show
render :text => ""
end

# DELETE /activities/1
# DELETE /activities/1.xml
def destroy
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class CommentsController < ApplicationController
before_filter :authorize_destroy, :only => [:destroy]
before_filter :connection_required

def index
redirect_to comments_url
end

def show
redirect_to comments_url
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/blog_post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class BlogPost < Post
attr_accessible :title, :body

belongs_to :blog
has_many :comments, :as => :commentable, :order => :created_at
has_many :comments, :as => :commentable, :order => :created_at,
:dependent => :destroy

validates_presence_of :title, :body
validates_length_of :title, :maximum => MAX_TITLE
Expand Down
27 changes: 0 additions & 27 deletions app/views/activities/edit.html.erb

This file was deleted.

24 changes: 0 additions & 24 deletions app/views/activities/index.html.erb

This file was deleted.

26 changes: 0 additions & 26 deletions app/views/activities/new.html.erb

This file was deleted.

18 changes: 0 additions & 18 deletions app/views/activities/show.html.erb

This file was deleted.

6 changes: 5 additions & 1 deletion app/views/people/_wall.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<%- column_div :type => :primary do -%>
<h2><%= @person.name %>'s Comment Wall</h2>
<a name="wall"></a>

<p><%= formatting_note %></p>
<%- unless @person.comments.empty? -%>
<ul class="list comments full">
<%= render :partial => 'comment', :collection => @person.comments %>
</ul>
<%- end -%>
<%- end -%>
<%- column_div :type => :secondary do -%>
<%- if connected_to?(@person) -%>

<%- if connected_to?(@person) -%>
<h2>Add Comment</h2>
<% form_for :comment, :url => person_comments_path(@person) do |f| %>
<div class="form_row">
Expand Down
12 changes: 5 additions & 7 deletions lib/tasks/db_recycle.rake
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
namespace :db do
desc "Recycle the database by dropping, recreating, and migrating"
desc "Recycle the databases by dropping, recreating, and migrating"
task :recycle => :environment do
filename = File.join(RAILS_ROOT, 'config', 'database.yml')
config = YAML::load(File.open(filename))
env = ENV['RAILS_ENV'] || 'development'
database = config[env]['database']
ActiveRecord::Base.connection.execute("DROP DATABASE #{database}")
ActiveRecord::Base.connection.execute("CREATE DATABASE #{database}")
system 'rake db:drop:all'
system 'rake db:create:all'
system 'rake db:migrate'
system 'rake db:test:prepare'
end
end
1 change: 0 additions & 1 deletion lib/tasks/install.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ require 'active_record/fixtures'

desc "Install Insoshi"
task :install => :environment do |t|
Rake::Task["db:create:all"].invoke
Rake::Task["db:migrate"].invoke
Preference.create!
end
10 changes: 6 additions & 4 deletions lib/tasks/sample_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ def make_messages(text)
senders.each do |sender|
subject = some_text(SMALL_STRING_LENGTH)
Message.unsafe_create!(:subject => subject, :content => text,
:sender => sender, :recipient => michael,
:send_mail => false)
:sender => sender, :recipient => michael,
:send_mail => false,
:conversation => Conversation.new)
Message.unsafe_create!(:subject => subject, :content => text,
:sender => michael, :recipient => sender,
:send_mail => false)
:sender => michael, :recipient => sender,
:send_mail => false,
:conversation => Conversation.new)
end
end

Expand Down
2 changes: 2 additions & 0 deletions script/install
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ puts "Creating empty files. Please ignore permissions error messages."
system("rake gems:install")
# Install the gem dependencies (if any).
system("sudo rake gems:install")
# Create the databases.
system("rake db:create:all")
# Run the main install task.
system("rake install")
20 changes: 18 additions & 2 deletions spec/models/blog_post_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

before(:each) do
@post.save
comment = @post.comments.unsafe_create(:body => "The body",
:commenter => people(:aaron))
@comment = @post.comments.unsafe_create(:body => "The body",
:commenter => people(:aaron))
end

it "should have associated comments" do
Expand All @@ -61,5 +61,21 @@
@post.blog.person.activities.should contain(activity)
end
end

it "should destroy the comments if the post is destroyed" do
comments = @post.comments
@post.destroy
comments.each do |comment|
comment.should_not exist_in_database
end
end

it "should destroy the comments activity if the post is destroyed" do
comments = @post.comments
@post.destroy
comments.each do |comment|
Activity.find_by_item_id(comment).should be_nil
end
end
end
end

0 comments on commit b9639fe

Please sign in to comment.