mirror of
https://github.com/fspc/bike-database.git
synced 2025-04-04 10:03:22 -04:00
lk | redirects to bike edit page when bike updated successfully
This commit is contained in:
parent
0ee1168f6a
commit
b7090dba0d
@ -48,7 +48,7 @@ class BikesController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @bike.update(bike_params)
|
if @bike.update(bike_params)
|
||||||
redirect_to @bike, notice: 'Bike was successfully updated.'
|
redirect_to edit_bike_path(@bike), notice: 'Bike was successfully updated.'
|
||||||
else
|
else
|
||||||
render action: 'edit'
|
render action: 'edit'
|
||||||
end
|
end
|
||||||
|
1
notes.md
1
notes.md
@ -8,6 +8,7 @@
|
|||||||
- restyle agencies page to not have show or destroy links
|
- restyle agencies page to not have show or destroy links
|
||||||
|
|
||||||
# Tech
|
# Tech
|
||||||
|
- bike date_sold column should be datetime
|
||||||
- remove bike#entry_date column because it is now fixed_at
|
- remove bike#entry_date column because it is now fixed_at
|
||||||
- add tests to ensure that pages render
|
- add tests to ensure that pages render
|
||||||
- use log number in bike url instead of id
|
- use log number in bike url instead of id
|
||||||
|
@ -55,4 +55,11 @@ describe BikesController do
|
|||||||
expect(assigns(:next_bike)).to eq(@next_bike)
|
expect(assigns(:next_bike)).to eq(@next_bike)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#update" do
|
||||||
|
it "redirects to edit bike path when bike is updated" do
|
||||||
|
bike = create :bike
|
||||||
|
expect( put :update, id: bike.id, bike: {brand: "foobar"} ).to redirect_to action: :edit, id: assigns(:bike).id
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user