Skip to content

Commit

Permalink
Roles are now displayed on the Actors#show and Movies#show pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
declan committed Dec 31, 2011
1 parent 0a88134 commit b14596a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/views/actors/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@

<%= link_to 'Edit', edit_actor_path(@actor) %> |
<%= link_to 'Back', actors_path %>

<h3>Roles</h3>
<table>
<% @actor.roles_rels.each do |r| %>
<tr>
<td><%= sanitize r.as %> in <%= link_to(sanitize(r.end_node.title), movie_path(r.end_node)) %>
</tr>
<% end %>
</table>
10 changes: 9 additions & 1 deletion app/views/movies/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
<td>Year</td>
<td><%= @movie.year %></td>
</tr>

</table>

<%= link_to 'Edit', edit_movie_path(@movie) %> |
<%= link_to 'Back', movies_path %>

<h3>Actors</h3>
<table>
<% @movie.actors_rels.each do |r| %>
<tr>
<td><%= link_to(sanitize(r.start_node.name), actor_path(r.start_node)) %> as <%= sanitize r.as %></td>
</tr>
<% end %>
</table>
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Neo4jRailsExample::Application.routes.draw do
resources :users

resources :actors
resources :actors do
#get 'actor/:a_id/movie/:m_id'
end

resources :movies

Expand Down
3 changes: 3 additions & 0 deletions public/stylesheets/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table {
margin-bottom: 20px;
}

0 comments on commit b14596a

Please sign in to comment.