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

Betsy Complete - Team Fuzzy #12

Open
wants to merge 422 commits into
base: fuzzy/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
422 commits
Select commit Hold shift + click to select a range
dbabce2
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 11, 2015
0bda1ef
Working on patch update tests in products controller spec file
lacuchilla Dec 11, 2015
b136394
Added stuff for block-grid
daphnegold Dec 11, 2015
89f2938
oops the stuff I added to application.scss is broken
daphnegold Dec 11, 2015
85d24d5
fix get cart test in order items controller
lacuchilla Dec 11, 2015
f7f2a47
Some bootstrap and org for product index
daphnegold Dec 12, 2015
ec03789
Sidebar accordion
daphnegold Dec 12, 2015
1b74343
More sidebar accordion
daphnegold Dec 13, 2015
0dca540
Added stuff to application.js in order to switch buttons for accordio…
daphnegold Dec 13, 2015
af9997c
Fixed an issue with the accordion js
daphnegold Dec 13, 2015
9294105
More CSS for sidebar and images
daphnegold Dec 13, 2015
bc25847
Switch to dropdown for small devices (instead of sidebar)
daphnegold Dec 13, 2015
a6d0194
Trying to fix broken tests for order items controller
lacuchilla Dec 14, 2015
4aeb969
Add shell tests to be filled out tomorrow when we work on tests
lacuchilla Dec 14, 2015
985a01a
Fixed javascript thingy
daphnegold Dec 14, 2015
4fda453
Fixed some model specs and some controller specs
noglows Dec 14, 2015
444c24b
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 14, 2015
8736547
Fixing rspec tests
noglows Dec 14, 2015
c57775b
Cookies are signed now. Added remove functionality and 0 to delete or…
daphnegold Dec 14, 2015
99fadff
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 14, 2015
39858ea
More trying to write tests in the order items controller
lacuchilla Dec 14, 2015
3a3fb49
Mostly done with form for checkout
daphnegold Dec 14, 2015
ea41ca8
Shopping cart page no longer prompts user to sign in...
daphnegold Dec 14, 2015
e523d91
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 14, 2015
badb172
Updated user model specs
noglows Dec 14, 2015
404e94e
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 14, 2015
0eab447
Updated user model specs
noglows Dec 14, 2015
263d28e
adjust tests in order items controller
lacuchilla Dec 14, 2015
1f5e8ab
Can't review own products
noglows Dec 14, 2015
9decdeb
Cart sorts in stock from out of stock items
daphnegold Dec 14, 2015
d28c145
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 14, 2015
4c341c7
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 14, 2015
f33bc35
Cannot edit or delete another user's products
noglows Dec 14, 2015
1c9eab5
Cannot view another users account details page
noglows Dec 14, 2015
74d4b0d
passing spec for creating new order when first order item created
Dec 14, 2015
3640bda
erge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/master
Dec 14, 2015
4f04cea
Fixed the login bug
noglows Dec 14, 2015
08edd3a
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 14, 2015
5779801
Removed a binding.pry
noglows Dec 14, 2015
6be08a5
Updated checkout to show items in cart
daphnegold Dec 14, 2015
2f72973
Fixed the model specs
noglows Dec 14, 2015
4b13fa2
passing specs for creating or not creating appropriately a new order …
Dec 14, 2015
9026938
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 14, 2015
8e8832a
Order card_exp is now a date object
daphnegold Dec 14, 2015
1f6cb41
Fixing merge conflict in schema.rb
daphnegold Dec 14, 2015
d5743cc
Working on fixing order completion logic
noglows Dec 14, 2015
0a8cdf2
Fixed merge conflicts
noglows Dec 14, 2015
ed4538a
Shipping orders/marking orders as complete logic working
noglows Dec 15, 2015
2917e52
Updated before_actions so signed in users cannot see another user's o…
noglows Dec 15, 2015
b23c2dc
Fixed issue with mismatched ends on the application controller
daphnegold Dec 15, 2015
a0313a0
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
961e4d5
controller specs order items
lacuchilla Dec 15, 2015
c012c74
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 15, 2015
3307238
Created presence true validations for order checkout, and mostly fini…
daphnegold Dec 15, 2015
f438242
Fixed some CSS
daphnegold Dec 15, 2015
76835c1
Added total instock cart sum to cart view
daphnegold Dec 15, 2015
a3dbea9
Total on checkout view as wel
daphnegold Dec 15, 2015
f947c2a
Some bug fixes from standup
noglows Dec 15, 2015
0c3926e
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
1d1df86
Can't get to the sign-in or new account page when logged in
noglows Dec 15, 2015
f76d1b6
Stock is adjusted when guest places an order
daphnegold Dec 15, 2015
2347148
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
e7e8453
If product inventory changes while user is checking out, redirect to …
daphnegold Dec 15, 2015
bfbea40
Fix merge conflict in products controller
lacuchilla Dec 15, 2015
6254e6d
Fix broken products controller tests for retire method. Retire method…
lacuchilla Dec 15, 2015
580d9c9
fixed bug with retired products not appearing in the grid correctly
daphnegold Dec 15, 2015
30a4b3b
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
b573536
Weeded out unnecessary routes
noglows Dec 15, 2015
53de52d
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
0239552
Bug fix - if there are no orders for a status, a message is displayed
noglows Dec 15, 2015
4f08176
Bug fix - you can no longer create a blank category
noglows Dec 15, 2015
722d6f0
Fix a couple of tests in products controller. So many tests still bro…
lacuchilla Dec 15, 2015
74dfbad
changed spacing
Dec 15, 2015
a53e66b
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 15, 2015
abe60e4
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
df6cb72
Small controller bug fix - categories were broken
noglows Dec 15, 2015
4fe2d81
Bug fix - you can add/edit a product without setting categories
noglows Dec 15, 2015
2ec8732
Fixed grid bug on front page
daphnegold Dec 15, 2015
ec72784
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
661a733
Working on confirmation page
noglows Dec 15, 2015
5670329
working on product show page
daphnegold Dec 15, 2015
d38d59c
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
f75df93
set up it and params for PATCH update
Dec 15, 2015
da72987
Order confirmation page complete
noglows Dec 15, 2015
2f1a762
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
84cb9ee
Added unit price to shopping cart
noglows Dec 15, 2015
9445777
Some css for product show page
daphnegold Dec 15, 2015
27f0b1d
spec for update redirects to cart is passing
Dec 15, 2015
cd8f14b
Fixed formatting of CC expiration
noglows Dec 15, 2015
ec56507
spec set, but NOT PASSING for update destroys when quantity is 0
Dec 15, 2015
38154f0
spec PASSING for update destroys when quantity is 0
Dec 15, 2015
1163110
spec added and IS PASSING for update does not destroy when quantity i…
Dec 15, 2015
a751185
Wrote specs for application_helper
noglows Dec 15, 2015
c846085
Price was missing from product show page
daphnegold Dec 15, 2015
2d7a353
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
a5fa960
Spec files no longer show up in the coverage report
noglows Dec 15, 2015
4698e87
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
40cef86
More css for product show page
daphnegold Dec 15, 2015
8806044
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
d71b500
Fixed issue with picture resizing on product show view
daphnegold Dec 15, 2015
76fcade
specs written and PASSING for update method
Dec 15, 2015
604581e
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 15, 2015
0dfd5de
spec for destroy renders cart written and NOT passing
Dec 15, 2015
0d42965
spec for destroy renders cart written and IS PASSING
Dec 15, 2015
2b556d6
spec written and NOT PASSING for delete destorys the order item from …
Dec 15, 2015
ae7b532
spec written and IS PASSING for delete destorys the order item from t…
Dec 15, 2015
067c896
spec written and NOT PASSING for index renders index view
Dec 15, 2015
8e5618e
Worked on user controller specs
noglows Dec 15, 2015
58b31ed
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
df2c7bc
Additional user controller specs
noglows Dec 15, 2015
780d58c
removed old order seed data
Dec 15, 2015
b875f4c
Some fonts we can change, some CSS
daphnegold Dec 15, 2015
89e14ad
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
941d842
More CSS and some glyphicons
daphnegold Dec 15, 2015
7bc860b
spec written and IS PASSING for index renders index view
Dec 15, 2015
af40ab7
Sessions controller spec complete
noglows Dec 15, 2015
d816705
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
5a22034
More fiddling. Tests are so broken.
lacuchilla Dec 15, 2015
8629431
Fix merge conflict in sessions controller spec
lacuchilla Dec 15, 2015
186d8bb
Changed color of captions
daphnegold Dec 15, 2015
ef4a1a8
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
9c5e732
Add user model specs
noglows Dec 15, 2015
5d0938c
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 15, 2015
b8bb782
prep for merge
Dec 15, 2015
1515a13
fixed merge errors from testing
Dec 15, 2015
bd89fcd
Fixed bug in sessions controller spec
noglows Dec 15, 2015
cde8b2d
Amy and Daphne Fixed all the things in Products Controller spec YAYYYYY
daphnegold Dec 15, 2015
eeade41
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 15, 2015
fe3118d
Misaligned grids on front page fixed
daphnegold Dec 16, 2015
5b19b92
Linear Gradient for Navbar
daphnegold Dec 16, 2015
2df8cc7
Fixed bug with products index sorts
daphnegold Dec 16, 2015
1271900
Fixed some css and random things
daphnegold Dec 16, 2015
b16049d
more play time with css
daphnegold Dec 16, 2015
6bb3b3f
bug with date dropdowns being too narrow fixed
daphnegold Dec 16, 2015
a6246e4
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 16, 2015
758fd1f
Fixed off center front page body
daphnegold Dec 16, 2015
2b357a1
Realigned site title
daphnegold Dec 16, 2015
3e7d091
Worked on test coverage for the application controller
noglows Dec 16, 2015
1291554
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 16, 2015
b720c8a
Addition application controller coverage
noglows Dec 16, 2015
2a1a476
Spec cleanup
noglows Dec 16, 2015
fd834de
Fixed form validation for new product
noglows Dec 16, 2015
d33faf6
Bug fix - Edit form not submitting
noglows Dec 16, 2015
d98d87e
Add working tests for orders controller for the index and show actions
lacuchilla Dec 16, 2015
c28fd1f
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 16, 2015
8eac902
fix merge conflicts
Dec 16, 2015
88adecf
Fixed broken prod controller spec
daphnegold Dec 16, 2015
0fd02e1
Increased test coverage for order model
noglows Dec 16, 2015
92c15ec
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 16, 2015
da03b60
products controller show spec
Dec 16, 2015
661841a
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 16, 2015
1d0e5c1
Added more seed data
noglows Dec 16, 2015
ba8a85c
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 16, 2015
57c3a5a
added orders controller specs
daphnegold Dec 16, 2015
cbcdd8a
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 16, 2015
6ddbfc3
Blocked users from viewing other user's content
noglows Dec 16, 2015
cac657d
Added validator so only images can be added for image url
noglows Dec 16, 2015
106bfbf
More orders controller rspec tests
daphnegold Dec 16, 2015
49b00d2
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 16, 2015
43e5e8a
Fixed the products controller spec
noglows Dec 16, 2015
9ff0c18
Add working test for ship method in orders controller
lacuchilla Dec 16, 2015
e74ff16
Minor changes to css
daphnegold Dec 17, 2015
3afbb6f
All but one order controller method is covered by tests
lacuchilla Dec 17, 2015
0b68b4d
Working on products controller spec
noglows Dec 17, 2015
122969a
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 17, 2015
72e4e8c
Removed a binding.pry
noglows Dec 17, 2015
83f55c9
commit for specs
Dec 17, 2015
cd144ac
commit merge
Dec 17, 2015
75d90f4
Removed another instance of Pry
noglows Dec 17, 2015
d3c16ab
Fixed the nav bar
noglows Dec 17, 2015
ebe059b
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 17, 2015
d398bc4
Fixed issue with order total and products not showing up on confirmat…
daphnegold Dec 17, 2015
7e6bcab
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 17, 2015
1939f01
Add 2 tests for confirmation method in orders controller. Almost 97 p…
lacuchilla Dec 17, 2015
60709e6
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 17, 2015
7ee312a
Really fixed the bug with confirmation this time
daphnegold Dec 17, 2015
2af7bb5
Prepared gemfile for Heroku
noglows Dec 17, 2015
0603b0f
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 17, 2015
6e62c89
footer for additional space
daphnegold Dec 17, 2015
545eae6
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 17, 2015
8c0e49d
cvv field added
Dec 17, 2015
3dfb896
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 17, 2015
acf267f
city and state fields
Dec 17, 2015
c78cd21
Add working test for one of the next lines in the index method for th…
lacuchilla Dec 17, 2015
f5770c8
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 17, 2015
0534978
Fix merge conflict
lacuchilla Dec 17, 2015
ad9ad66
Added javascript to load ship form but no form yet
daphnegold Dec 17, 2015
b48e275
Fixed merge issue in products_controller_spec
noglows Dec 17, 2015
c04fe87
Fixed the database issues for real this time
noglows Dec 17, 2015
87ce8c2
Things
lacuchilla Dec 17, 2015
5bbdbb0
Fix merge conflict
lacuchilla Dec 17, 2015
6b44083
Finished form for billing information
daphnegold Dec 17, 2015
f65ec23
Added validation to price, quantity
noglows Dec 17, 2015
f371d68
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 17, 2015
35a28aa
Required first/last name, added length requirements
noglows Dec 17, 2015
fdd61c1
Bug fix - Only see categories and merchants that have products
noglows Dec 18, 2015
b75fe00
Add length maximum validation for the name and description fields to …
lacuchilla Dec 18, 2015
c0e08c7
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 18, 2015
4b0c538
Fixed merge conflict and checkout form
daphnegold Dec 18, 2015
dc78760
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 18, 2015
a56950e
Validate length of the name and description of product
daphnegold Dec 18, 2015
c483420
Word wrap for long words in small spaces
daphnegold Dec 18, 2015
3625e63
Added min/max limits for category names
noglows Dec 18, 2015
edf1008
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 18, 2015
b6806e8
validation for expiration of card being in the future
daphnegold Dec 18, 2015
ca8136d
maxlength for product name and product description set
Dec 18, 2015
46987b4
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 18, 2015
4421a94
min and max number limit for product price and product inventory
Dec 18, 2015
309a02d
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 18, 2015
cab2b00
max length for new category name is set
Dec 18, 2015
d8cdf94
Fix things
lacuchilla Dec 18, 2015
a7211b5
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Dec 18, 2015
8d648bf
flash messages for cart changes has been updated to be more clear
Dec 18, 2015
e74b3f0
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 18, 2015
5bfed85
quantity drop down on cart when cart has changed is now in correct po…
Dec 18, 2015
ad771cf
after writing a review, page redirects to review tab
daphnegold Dec 18, 2015
7595454
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 18, 2015
d2c8ce4
added stars to the reviews section
Dec 18, 2015
881c728
made error for not allowing review of own product to be more clear us…
Dec 18, 2015
5459c03
Fixed failing user tests
noglows Dec 18, 2015
f08f835
Commented out unused code in products controller (line 16)
noglows Dec 18, 2015
a1a4a08
Updated failing test in products_controller
noglows Dec 18, 2015
1e61e0c
fix cart has updated bug
Dec 18, 2015
c477c7b
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 18, 2015
6b2d528
More options for credit card expiration year
noglows Dec 18, 2015
0ba7ccd
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
noglows Dec 18, 2015
4fc46ad
Moved the All Orders to the top of the order fulfillment page
noglows Dec 18, 2015
0be1b52
Average review rounds to 1 decimal place
noglows Dec 18, 2015
5858160
Fixed the timezone
noglows Dec 18, 2015
0f9e060
deleted some unused empty files and fixed flash errors for reviews
daphnegold Dec 18, 2015
ec280a0
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 18, 2015
a405c9a
moar seeds
Dec 18, 2015
de3c8d2
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Dec 18, 2015
0a4ca03
Fixed overflowing div
daphnegold Dec 18, 2015
2bfe2ab
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
daphnegold Dec 18, 2015
5aece42
Bug fix - order items in orders
noglows Dec 18, 2015
2665fcc
Update README.md
noglows Dec 18, 2015
f8e45f6
rspec tests
lacuchilla Jan 18, 2016
b919915
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Jan 18, 2016
bf38408
remove commented out code
Jan 18, 2016
b236df1
remove commented out code
Jan 18, 2016
2fe2cb9
remove commented out code
Jan 18, 2016
088b2f1
move instock logic out of the cart view
Jan 18, 2016
a53835d
move logic out of cart view
Jan 18, 2016
c2720c6
Code fixes for things
lacuchilla Jan 18, 2016
ddf7f5d
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
lacuchilla Jan 18, 2016
82b76aa
move shipped status logic out of view and into helper
Jan 18, 2016
1b81b95
Merge branch 'fuzzy/master' of github.com:noglows/betsy into fuzzy/ma…
Jan 18, 2016
c903e00
move reverse logic from controller to model
Jan 19, 2016
b83ccbd
move reverse logic from controller to model
Jan 19, 2016
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
Prev Previous commit
Next Next commit
Can't review own products
  • Loading branch information
noglows committed Dec 14, 2015
commit 1f5e8ab2127949c5de8f8237cb324a419f320949
17 changes: 17 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
end

def require_login
if current_user.nil?
flash[:error] = "You must be logged in to view this section"
redirect_to new_session_path
end
end

def check_user
if @current_user != nil
product = params[:product_id]
if Product.find(product).user == @current_user
flash[:error] = "You can't review your own products"
redirect_to user_product_path(@current_user.id, product)
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class ProductsController < ApplicationController
before_action :current_user
before_action :require_login, only: [:new, :create, :edit, :update, :retire]
before_action :check_user, only: [:review, :retire]

def index
@products = Product.order(:created_at)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create
redirect_to root_path
else
# user is not Authenticated
flash.now[:error] = "Hmmm, that password doesn't seem quite right..."
flash.now[:error] = "Hmmm, that password/email combination doesn't seem quite right..."
render :new
end
else
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class UsersController < ApplicationController
before_action :current_user

before_action :require_login, only: [:show, :new_category]

def new
@user = User.new
end
Expand Down
4 changes: 4 additions & 0 deletions app/views/products/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<% if !flash[:error].nil? %>
<%= flash[:error] %>
<% end %>

<h1><%= @product.name %></h1>
<div class="row">
<%= image_tag @product.image_url, class: "img-responsive" %>
Expand Down