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

make sure all tests pass after the merge conflict #23

Merged
merged 1 commit into from
Nov 30, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
class UsersController < ApplicationController
def index
@users = User.all
end

def show
@user = User.find(params[:id])
end

def new
@user = User.create(user_params)
@user = User.new
end

def create
@user = User.new(user_params)

if @user.save
redirect_to user_dashboard_path(@user)
else
render :new
end
end

private

def user_params
params.permit(:name, :email)
params.require(:user).permit(:name, :email)
end
end
1 change: 1 addition & 0 deletions app/views/users/discover/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= render partial: "shared/nav" %>
1 change: 0 additions & 1 deletion app/views/users/discovers/index.html.erb

This file was deleted.

5 changes: 4 additions & 1 deletion app/views/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<%= render partial: "shared/nav" %>
<h1>Viewing Party</h1>

<p><%= button_to "New User", 'users/new' %></p>
<p><%= button_to "New User", register_path, method: :get %></p>

<h3>User Index</h3>
<%@users.each do |user|%>
<ol>
<%= link_to "#{user.name}", "users/#{user.id}"%>
</ol>
<%end%>
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= render partial: "shared/nav" %>

<h1><%="#{@user.name}'s Dashboard"%></h1>
<%= button_to "Discover Movies", user_discover_index_path(@user.id), method: :get, params: { enabled: false }, data: { turbo: false }, local: true %>
<%= button_to "Discover Movies", user_discover_path(@user.id), method: :get, params: { enabled: false }, data: { turbo: false }, local: true %>

<section id = "viewing-parties">
<h3>Parties I'm Hosting</h3>
Expand Down
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
IdUl8TW1RuV/hrFBOw2ofbe8+xWVzpTQtF36N+5vBKyWgaq4Juryc86xLP3lLDmJ8pVNpg/g8TYSAWeu+JUTlE4iCq31IZTknkB4BPLpz4ULj3UpYkEFRSB9ZdDufx9ccU4l+4GGtdv5KRqc105s0v09MDWYT+X6NHHUrFlSGepCEXzG7JuQziJCcYxDZccsb0qlsdcUnpWspc6GBBo451lm0YviUcWx3kNsSNqApQqtQENrruynV3UoKipateylgTlrUlOMbYyHIkY1daxdV4EcxSIF1mUy6UwciNIC9xa0WnAGb+oaki6mPvs+FpWz+o548lWRrz91opxNIBv8Zrh+ZwfnQVxByuI2Uqj4fYbETjhbRfu2IbjTk1sQGqZlgougYXtMmCTxe8PNP29bmaxa2s7r4i2dAb9P--jqBTwrKsjHULkBor--z3IhADU0xjCYptFz4QGfyw==
SxQohDKYA2r9lWQqWmurByftmF/EALpC6dTEQShJwObokj/7ool3oJW9bzj34LTRACv35C3RYDQMvcfX2QE6q88SSLCdfyiQHAd2ch01roG5N87zn1cUJc40LGBTvMogGhomBXRnKXovGAAnuqKy4nNpvCN9DXVlTMnWy42usSLOZ1Li9oPggu4wiRxhfvQXnB0RevOjbJQgDV/peQCAAA8Lspidp+IRMSyF79mEA41hpTx/VQxmldnSKExDlpgKpmtwO+F+BGOGJu2CVRWgb4eh1v3woHlnITlWKU8JwzQmyV+e5qSSeEZEb7qhm8EH+xKrW0Kn+OyudCA1qGHfgChvIC149A8ATy/d3/rMqZwvcUEwum0u/4nryLx+0Fq00vcA4roqQoGStF8wciNwU06g5+XwaoYAjDN0s3TJhoIvBlcwu3nwl/e9ywuafa1hHiPGsdNCc/cVtmRgtUIoRuRbWg==--vLv+FJCRu+mocla1--PFdQ6QmMlCPQkevBfDzbvg==
7 changes: 4 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Defines the root path route ("/")
# root "articles#index"
get '/', to: 'users#index', as: :root
get 'users/:id', to: 'users#show'
post '/users/new', to: 'users#new', as: :new_user_path
get '/users/:id/discover', to: 'users/discovers#index', as: :user_discover
get 'users/:id', to: 'users#show', as: :user_dashboard
get '/register', to: 'users#new'
post '/register', to: 'users#create'
get '/users/:id/discover', to: 'users/discover#index', as: :user_discover
end
2 changes: 1 addition & 1 deletion spec/features/landing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

expect(page).to have_button('New User')
click_button('New User')
expect(current_path).to eq('/users/new')
expect(current_path).to eq('/register')
end

it 'has a list of existing users' do
Expand Down
3 changes: 1 addition & 2 deletions spec/features/users/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

x = User.find_by(name: "Thomas Smith")

require 'pry'; binding.pry
expect(current_path).to eq(user_path(x.id))
expect(current_path).to eq(user_dashboard_path(x.id))
expect(page).to have_content("Thomas Smith's Dashboard")
expect(page).to have_content("Parties I'm Hosting")
expect(page).to have_content("Parties I'm Invited To")
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

expect(page).to have_button('Discover Movies')
click_button('Discover Movies')
expect(current_path).to eq(user_discover_index_path(user.id))
expect(current_path).to eq(user_discover_path(user.id))
end
end