Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show links in nodes

  • Loading branch information...
commit 896c3b707a8f56e8aee1e76b9ce693fa935549ad 1 parent f6a5e22
@KentonWhite authored
View
3  app/controllers/nodes_controller.rb
@@ -2,13 +2,14 @@ class NodesController < ApplicationController
before_filter :login_required
before_filter :get_maze
-
+
def index
@nodes = @maze.nodes.all
end
def show
@node = @maze.nodes.find(params[:id])
+ @links = @node.links.all
end
def new
View
4 app/views/nodes/_show_links.html.erb
@@ -0,0 +1,4 @@
+ <strong>Links:</strong>
+ <% @links.each do |link| %>
+ <p><%= link_to link.text, maze_node_path(@maze, link.to_node_id) %></p>
+ <% end %>
View
3  app/views/nodes/show.html.erb
@@ -7,6 +7,9 @@
<p>
<strong>Content:</strong>
<%= @node.content %>
+</p>
+<p>
+<%= render :partial => 'show_links' %>
</p>
<p>

0 comments on commit 896c3b7

Please sign in to comment.
Something went wrong with that request. Please try again.