Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gods index #8

Merged
merged 3 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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