Skip to content

Commit

Permalink
#56 finished coding
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaHany94 committed Apr 6, 2015
1 parent dcf1fc6 commit 31a0807
Show file tree
Hide file tree
Showing 4 changed files with 2,205 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/magazines_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def index
# GET /magazines/1
# GET /magazines/1.json
def show
@join = Requestjoiningmagazine
.where('user_id = ? AND magazine_id = ?', current_user.id, params[:id])
end

# GET /magazines/new
Expand Down Expand Up @@ -84,7 +86,6 @@ def check_for_cancel
def join
joinh = { "user_id" => current_user.id, "magazine_id" => params[:id] }
Requestjoiningmagazine.create(joinh)
flash[:notice] = "A joining request has been sent."
@magazine = Magazine.find(params[:id])
redirect_to @magazine
end
Expand Down
5 changes: 3 additions & 2 deletions app/views/magazines/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<p id="notice"><%= notice %></p>
<%= flash[:notice]%>
<% if @join.present? %>
<%= flash[:notice] = "You have requested joining this magazine." %>
<% end %>
<p>
<strong>Name:</strong>
<%= @magazine.name %>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
Loading

0 comments on commit 31a0807

Please sign in to comment.