Skip to content

Instantly share code, notes, and snippets.

@richardsondx
Created March 9, 2012 05:58
Show Gist options
  • Save richardsondx/2005260 to your computer and use it in GitHub Desktop.
Save richardsondx/2005260 to your computer and use it in GitHub Desktop.
Routes
What I am trying to do is: while I am using paginate and navigating through the pages, I want the user to be able to click on a micropost.content and be redirected to the micropost 'display' view as I am using the show view for the admin side.
microposts_show GET /microposts/show(.:format) microposts#show
microposts_display GET /microposts/display(.:format) microposts#display
def show
@micropost = Micropost.find(params[:id])
end
#i want the display page to behave like the show vie
def display
@micropost = Micropost.find(params[:id])
end
<p>
<strong>content:</strong>
<%= @micropost.content %>
</p>
<p>
<strong>tag:</strong>
<%= @micropost.tag %>
</p>
<%= paginate @microposts%>
<% for micropost in @microposts %>
<h2><%= micropost.id %></h2>
<td><%= link_to micropost.content, microposts_display_path => micropost %> </td>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment