<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/controllers/attachments.rb</filename>
    </added>
    <added>
      <filename>app/models/attachment.rb</filename>
    </added>
    <added>
      <filename>app/views/topics/_post_form.html.erb</filename>
    </added>
    <added>
      <filename>schema/migrations/009_attachment_migration.rb</filename>
    </added>
    <added>
      <filename>spec/controllers/attachments_spec.rb</filename>
    </added>
    <added>
      <filename>spec/helpers/attachments_helpers.rb</filename>
    </added>
    <added>
      <filename>spec/models/attachment_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,4 +4,5 @@ db/*.sqlite3
 schema/schema.rb
 log/*
 gems
-script
\ No newline at end of file
+script
+public/uploads
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,7 @@ class Forums &lt; Application
   def create
     @forum = Forum.new(params[:forum])
     if @forum.save
+      flash[:notice] = @forum.name + &quot; created successfully&quot;
       redirect url(:forums)
     else
       render :new
@@ -39,6 +40,7 @@ class Forums &lt; Application
     @forum = Forum.find_by_param(params[:id])
     raise NotFound unless @forum
     if @forum.update_attributes(params[:forum])
+      flash[:notice] = @forum.name + &quot; updated successfully&quot;
       redirect url(:forums)
     else
       raise BadRequest</diff>
      <filename>app/controllers/forums.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,7 @@ class Posts &lt; Application
   def create
     @post = Post.new(params[:post].merge({ :user =&gt; current_user, :forum =&gt; @forum, :topic =&gt; @topic }))
     if @post.save
+      flash[:notice] = &quot;Post Created&quot;
       redirect url(:forum_topic, { :forum_id =&gt; @forum, :id =&gt; @topic })
     else
       render :new
@@ -28,6 +29,7 @@ class Posts &lt; Application
     @post = Post.find(params[:id])
     raise NotFound unless @post
     if @post.update_attributes(params[:post])
+      flash[:notice] = &quot;Post Updated&quot;
       redirect url(:forum_topic, { :forum_id =&gt; @forum, :id =&gt; @topic })
     else
       raise BadRequest</diff>
      <filename>app/controllers/posts.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@ class Sessions &lt; Application
         self.current_user.remember_me
         cookies[:auth_token] = { :value =&gt; self.current_user.remember_token , :expires =&gt; self.current_user.remember_token_expires_at }
       end
+      flash[:notice] = &quot;Welcome back, &quot; + self.current_user.login
       redirect_back_or_default('/')
     else
       render :new</diff>
      <filename>app/controllers/sessions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,7 @@ class Topics &lt; Application
   def create
     @topic = @forum.topics.new(params[:topic].merge(:user =&gt; current_user))
     if @topic.save
+      flash[:notice] = @topic.name + &quot; created successfully&quot;
       redirect url(:forum_topic, { :forum_id =&gt; @forum, :id =&gt; @topic })
     else
       render :new
@@ -46,6 +47,7 @@ class Topics &lt; Application
     @topic = Topic.find_by_param(params[:id])
     raise NotFound unless @topic
     if @topic.update_attributes(params[:topic])
+      flash[:notice] = @topic.name + &quot; updated successfully&quot;
       redirect url(:forum_topic_posts,:topic_id =&gt; @topic)
     else
       raise BadRequest</diff>
      <filename>app/controllers/topics.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
-class Post &lt; ActiveRecord::Base
-  
+class Post &lt; ActiveRecord::Base  
   before_save :formatted_body
 
+  has_many :attachments
   belongs_to :forum, :counter_cache =&gt; true
   belongs_to :topic, :counter_cache =&gt; true
   belongs_to :user, :counter_cache =&gt; true
@@ -14,4 +14,9 @@ class Post &lt; ActiveRecord::Base
     write_attribute(:body_html, RedCloth.new(Whistler.white_list(body)).to_html  )
   end
   
+  def attachments=(upload)
+    self.attachments.build(upload) unless upload.empty?
+  end
+  
+  
 end
\ No newline at end of file</diff>
      <filename>app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class Topic &lt; ActiveRecord::Base
   
-  has_many :posts
+  has_many :posts, :order =&gt; :updated_at
   belongs_to :forum, :counter_cache =&gt; true
   belongs_to :user, :counter_cache =&gt; true
   </diff>
      <filename>app/models/topic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,9 @@
         &lt;p&gt;Merbums is a merb powered forum heavily inspired by Beast.&lt;/p&gt;
         &lt;p&gt;Git repo at &lt;a href=&quot;http://github.com/shayarnett/merbums/tree/master&quot;&gt;http://github.com/shayarnett/merbums/tree/master&lt;/a&gt;.&lt;/p&gt;
         &lt;p&gt;This is a development deployment, there will be bugs, errros, and maybe even occasional database emptying. Feel free to register and play around, also post any bugs or feature requests you may have.&lt;/p&gt;&lt;/div&gt;
+      &lt;% if flash[:notice] %&gt;&lt;div class=&quot;notice&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/div&gt;&lt;% end %&gt;
+      &lt;% if flash[:error] %&gt;&lt;div class=&quot;error&quot;&gt;&lt;%= flash[:error] %&gt;&lt;/div&gt;&lt;% end %&gt;
+      &lt;% if flash[:message] %&gt;&lt;div class=&quot;notice&quot;&gt;&lt;%= flash[:message] %&gt;&lt;/div&gt;&lt;% end %&gt;
       &lt;% if controller_name == 'topics' &amp;&amp; action_name == 'index' %&gt;
         &lt;p&gt;&lt;%= link_to &quot;Home&quot;, url(:forums) %&gt;&lt;/p&gt;
       &lt;% elsif controller_name == 'topics' &amp;&amp; action_name == 'show' %&gt;</diff>
      <filename>app/views/layout/application.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -15,19 +15,16 @@
           &lt;%= post.user.login %&gt;&lt;br /&gt;
           &lt;%= post.user.posts.size %&gt; Posts&lt;/p&gt;
         &lt;/td&gt;
-        &lt;td&gt;&lt;div&gt;&lt;%= link_to &quot;Edit&quot;, url(:edit_forum_topic_post,{ :forum_id =&gt; @forum,:topic_id =&gt; @topic, :id =&gt; post} ) if can_edit?(post) %&gt;&lt;/div&gt;&lt;%= post.body_html %&gt;&lt;/td&gt;
+        &lt;td&gt;
+          &lt;div&gt;&lt;%= link_to &quot;Edit&quot;, url(:edit_forum_topic_post,{ :forum_id =&gt; @forum,:topic_id =&gt; @topic, :id =&gt; post} ) if can_edit?(post) %&gt;&lt;/div&gt;&lt;%= post.body_html %&gt;
+          &lt;%= tag :p, &quot;Attachments&quot; unless post.attachments.empty? %&gt;
+          &lt;% post.attachments.each do |attachment| %&gt;
+          &lt;p&gt;&lt;%= link_to attachment.title, attachment.path %&gt;&lt;/p&gt;
+          &lt;% end %&gt;
+        &lt;/td&gt;
       &lt;/tr&gt;
     &lt;% end %&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;
 
-&lt;% if logged_in? %&gt;
-  &lt;% form_for @post, :action =&gt; url(:forum_topic_post, { :forum_id =&gt; @forum, :topic_id =&gt; @topic }) do %&gt;
-    &lt;% fieldset :legend =&gt; &quot;Post a Reply&quot; do %&gt;
-      &lt;p&gt;&lt;%= text_area_control :body, :label =&gt; &quot;Reply&quot; %&gt;&lt;/p&gt;
-      &lt;p&gt;&lt;%= submit_button &quot;Submit&quot; %&gt;&lt;/p&gt;
-    &lt;% end %&gt;
-  &lt;% end %&gt;
-&lt;% else %&gt;
-&lt;p&gt;&lt;%= link_to &quot;Login&quot;, url(:login) %&gt; to reply&lt;/p&gt;
-&lt;% end %&gt;
\ No newline at end of file
+&lt;%= partial :post_form, :with =&gt; @post if logged_in? %&gt;</diff>
      <filename>app/views/topics/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -50,8 +50,11 @@ use_test :rspec
 # dependency &quot;RedCloth&quot;, &quot;&gt; 3.0&quot;
 # OR
 # dependencies &quot;RedCloth&quot; =&gt; &quot;&gt; 3.0&quot;, &quot;ruby-aes-cext&quot; =&gt; &quot;= 1.0&quot;
+%w(RedCloth whistler).each do |file|
+  require file
+end
 
-dependencies &quot;merb-assets&quot;, &quot;merb_helpers&quot;, &quot;RedCloth&quot;, &quot;whistler&quot;
+dependencies &quot;merb-assets&quot;, &quot;merb_helpers&quot;, &quot;merb_has_flash&quot;
 
 Merb::BootLoader.after_app_loads do
   ### Add dependencies here that must load after the application loads:</diff>
      <filename>config/init.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d620ecd20f8f86435ef43d3cf1e4faa81db557f5</id>
    </parent>
  </parents>
  <author>
    <name>Shay Arnett</name>
    <email>shayarnett@gmail.com</email>
  </author>
  <url>http://github.com/shayarnett/merbums/commit/0aecfad24ec78213bbe1695e36b14eab1fbc1abe</url>
  <id>0aecfad24ec78213bbe1695e36b14eab1fbc1abe</id>
  <committed-date>2008-03-27T17:16:01-07:00</committed-date>
  <authored-date>2008-03-27T17:16:01-07:00</authored-date>
  <message>added attachments and lots of flash[]</message>
  <tree>fa4421731896069c05b0ac5df45e0f14c372f20b</tree>
  <committer>
    <name>Shay Arnett</name>
    <email>shayarnett@gmail.com</email>
  </committer>
</commit>
