Created
March 9, 2012 05:58
-
-
Save richardsondx/2005260 to your computer and use it in GitHub Desktop.
Routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
microposts_show GET /microposts/show(.:format) microposts#show | |
microposts_display GET /microposts/display(.:format) microposts#display |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<strong>content:</strong> | |
<%= @micropost.content %> | |
</p> | |
<p> | |
<strong>tag:</strong> | |
<%= @micropost.tag %> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= 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