forked from AdaGold/media-ranker
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Leah - Water #52
Open
scottzec
wants to merge
42
commits into
Ada-C14:master
Choose a base branch
from
scottzec:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19,372
−0
Open
Leah - Water #52
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
26bf60e
Initial Rails Setup
scottzec b76497e
validations
scottzec 78bcd84
views
scottzec fd197ff
validation tests added and passing
scottzec 634df9d
prep for layout template
scottzec ec5c551
app and works#index html
scottzec bdacb6c
homepages#index html framework
scottzec c75a27b
works#index html framework
scottzec de97ac5
works form works show user show html base
scottzec 66fefc5
css
scottzec 48453dd
works listed by cat
scottzec 052aa61
change works index html buttons to erb
scottzec 4726c3c
works show
scottzec d568689
form with css new work
scottzec 2e85acd
spotlight finally working
scottzec 2096d79
css works on top 10
scottzec 809618e
spotlight tests, 1 still not passing
scottzec 91f3115
top 10 testing
scottzec 99a1cef
added fixtures
scottzec e02eb02
rollback successful after migration disaster, saving schema
scottzec 73cb04a
after updating fixtures to correct data type for publication_year, te…
scottzec 1c68da9
edit with flash blank page
scottzec 318c71e
delete with flash, same 404
scottzec e78f30c
edit and delete functioning again, flash to be resolved
scottzec 3ca8905
added flash to view
scottzec 3f04e2e
votes nested route
scottzec 7109e8a
added session routes
scottzec e33113b
login routes, actions and views setup. still need logout button
scottzec 13c6e8e
logout and current views all setup and running
scottzec 16428bf
vote create action
scottzec 75a7e20
migrations relating votes to user and work
scottzec 07e59e8
upvote functionality working
scottzec b3f5485
added votes for views
scottzec 862bfed
added filters to controllers
scottzec da23f4a
only 1 vote per user per work
scottzec f1be597
top 10, spotlight and works index all sorted by votes descending
scottzec 7680e3e
current user tests
scottzec 72e4aa6
vote fixtures
scottzec 3b026ad
vote fixtures
scottzec 8c34218
find_work controller working
scottzec 0bb9076
relationship tests
scottzec 5f3947d
user views complete with relation has many works thru votes
scottzec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
validation tests added and passing
commit fd197ff030d0e9747506826ec22c288fa1e554ce
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
class UsersController < ApplicationController | ||
|
||
def index | ||
@users = User.all | ||
end | ||
|
||
def show | ||
user_id = params[:id] | ||
@user = User.find_by(id: user_id) | ||
if @user.nil? | ||
# Change this to a 404 page | ||
redirect_to root | ||
end | ||
end | ||
|
||
def new | ||
@user = User.new | ||
end | ||
|
||
def create | ||
@user = User.new(user_params) | ||
if @user.save | ||
flash[:success] = "You have joined the ranker!" | ||
# @user or @user.id ? | ||
redirect_to user_path(@user.id) | ||
return | ||
else | ||
flash.now[:error] = "There's been an error. We couldn't add you to the system." | ||
render :new, status: :bad_request | ||
return | ||
end | ||
end | ||
|
||
private | ||
|
||
# Strong Params: https://learn-2.galvanize.com/cohorts/2036/blocks/1006/content_files/intro-to-rails/strong-params.md | ||
def user_params | ||
return params.require(:user).permit(:user_name, :join_date) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
require "test_helper" | ||
|
||
# Add Relations Tests in Wave 2 | ||
# Add Fixtures Later | ||
# New? Create? | ||
|
||
describe User do | ||
# it "does a thing" do | ||
# value(1+1).must_equal 2 | ||
# end | ||
it "is valid when all required fields are present" do | ||
# Arrange | ||
@user = User.new(user_name: "me") | ||
|
||
# Act | ||
created_user = @user.valid? | ||
|
||
# Assert | ||
expect(created_user).must_equal true | ||
end | ||
|
||
it "is invalid without title" do | ||
# Arrange | ||
@user = User.new | ||
|
||
#Act | ||
created_user = @user.valid? | ||
|
||
# Assert | ||
expect(created_user).must_equal false | ||
expect(@user.errors.messages).must_include :user_name | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
require "test_helper" | ||
|
||
# Add Relations Tests in Wave 2 | ||
# Add Fixtures Later | ||
# New? Create? | ||
|
||
describe Work do | ||
# it "does a thing" do | ||
# value(1+1).must_equal 2 | ||
# end | ||
it "is valid when all required fields are present" do | ||
# Arrange | ||
@work = Work.new(title: "Long", category: "Movie") | ||
|
||
# Act | ||
created_work = @work.valid? | ||
|
||
# Assert | ||
expect(created_work).must_equal true | ||
end | ||
|
||
it "is invalid without title" do | ||
# Arrange | ||
@work = Work.new(category: "Movie") | ||
|
||
#Act | ||
created_work = @work.valid? | ||
|
||
# Assert | ||
expect(created_work).must_equal false | ||
expect(@work.errors.messages).must_include :title | ||
end | ||
|
||
it "is invalid without category" do | ||
# Arrange | ||
@work = Work.new(title: "Long") | ||
|
||
#Act | ||
created_work = @work.valid? | ||
|
||
# Assert | ||
expect(created_work).must_equal false | ||
expect(@work.errors.messages).must_include :category | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either works, they do the same thing.