- +
- Content: + <%= @post.text %>
+ +<% if @post.music.present? %> Currently Listening To...: <%= @post.music %> + <% end %>
+<% if @post.mood.present? %>Current Mood: - <%= @post.mood %> -
-
+
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 93c877b..dfc97e1 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -7,7 +7,7 @@ class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] def index - @posts = @blog.posts + @posts = Post.order(created_at: :desc) end def show diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 172cf5c..0c18633 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -31,7 +31,7 @@
- Content: + <%= @post.text %>
+ +<% if @post.music.present? %> Currently Listening To...: <%= @post.music %> + <% end %>
+<% if @post.mood.present? %>Current Mood: - <%= @post.mood %> -
Comments
- <%= render @post.comments %> -add a comment... - <%= form_with( - model: [@post.blog.member, @post.blog, @post, Comment.new], - local: true - ) do |form| %> - - <%= form.label :commenter %>- <%= form.text_field :commenter %> -
- <%= form.label :body %>
- <%= form.rich_text_area :body %> - - <%= form.submit %> + <%= @post.mood %> <% end %> -