Skip to content

Commit

Permalink
Merge pull request #8 from TairTidhar/gods-index
Browse files Browse the repository at this point in the history
Gods index
  • Loading branch information
alixpalmer committed Nov 12, 2018
2 parents 1728691 + 8b137bc commit 3f217b8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
4 changes: 1 addition & 3 deletions app/controllers/gods_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class GodsController < ApplicationController
skip_before_action :authenticate_user!, only: :index
has_many :bookings
belongs_to :user


def index
@gods = God.all
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/user_controller.rb

This file was deleted.

17 changes: 17 additions & 0 deletions app/views/gods/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- index.html.erb -->

<!-- cocktail.html.erb -->
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-10 col-sm-offset-1">
<h1>Here is the list of all the Gods</h1>
<ul class="list-group">
<% @gods.each do |god| %>
<li class="list-group-item">
<%= link_to god.name, god_path(god) %>
</li>
<% end %>
</ul>
</div>
</div>
</div>
14 changes: 14 additions & 0 deletions app/views/gods/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- show.html.erb -->

<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-10 col-sm-offset-1">
<h1><%= @god.name %></h1>
<p><%= @god.location %></p>
<p><%= @god.description %></p>
<p><% @god.user.each do |god| %></p>
<%= user.name %>
<% end %>
</div>
</div>
</div>
5 changes: 5 additions & 0 deletions db/migrate/20181112070138_add_name_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNameToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :name, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_11_12_043710) do
ActiveRecord::Schema.define(version: 2018_11_12_070138) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -44,6 +44,7 @@
t.datetime "remember_created_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
Expand Down

0 comments on commit 3f217b8

Please sign in to comment.