Skip to content

Instantly share code, notes, and snippets.

@jblac
Last active December 12, 2015 06:19
Show Gist options
  • Save jblac/4728760 to your computer and use it in GitHub Desktop.
Save jblac/4728760 to your computer and use it in GitHub Desktop.
<% if signed_in? %>
<div class="row">
<aside class="span4">
<section>
<%= render 'shared/user_info' %>
</section>
<section>
<%= render 'shared/micropost_form' %>
</section>
</aside>
<div class="span8">
<h3>Micropost Feed</h3>
<%= render 'shared/feed' %>
</div>
</div>
<% end %>
-- micropost_controller --
class MicropostsController < ApplicationController
before_filter :signed_in_user
def create
@micropost = current_user.microposts.build(params[:micropost])
if @micropost.save
flash[:success] = "Micropost created!"
redirect_to root_url
else
@feed_items = current_user.feed.paginate(page: params[:page])
render 'static_pages/home'
end
end
def destroy
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment