Skip to content

Commit

Permalink
no more errors when repo doesn't have a group assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
slk187 committed May 19, 2013
1 parent 6c3c7af commit 97ab21a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 11 additions & 3 deletions app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ def edit

def show
@repository = Repository.find(params[:id])
@gtr = Grouptorepo.where("repository_id = ?", params[:id]).select("group_id").first
@x = Group.where("id = ?", @gtr.group_id).select("group_name").first

@usr = Usertogroup.where("group_id = ?", @gtr.group_id).all
if (@repository != nil)
@gtr = Grouptorepo.where("repository_id = ?", params[:id]).select("group_id").first
end

if (@gtr != nil)
@x = Group.where("id = ?", @gtr.group_id).select("group_name").first
end

if (@gtr != nil)
@usr = Usertogroup.where("group_id = ?", @gtr.group_id).all
end

@htr = Hook.all
# @htr = Repohook.where("repository_id = ?", params[:id]).all
Expand Down
14 changes: 9 additions & 5 deletions app/views/repositories/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
</p>
<p>
<b>Group:</b><br/>
<% if (@x != nil) %>
<%= @x.group_name %>
<% end %>
</p>
<p>
<b>Members:</b><br/>
<% @usr.each do |f| %>
<% (User.where("id = ?", f.user_id).select("email").all).each do |z|%>
<%= z.email %>
<br/>
<% end %>
<% if @usr != nil %>
<% @usr.each do |f| %>
<% (User.where("id = ?", f.user_id).select("email").all).each do |z|%>
<%= z.email %>
<br/>
<% end %>
<% end %>
<% end %>
</p>
<p>
Expand Down

0 comments on commit 97ab21a

Please sign in to comment.