-
Notifications
You must be signed in to change notification settings - Fork 0
Fix update endpoint #24
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
base: develop
Are you sure you want to change the base?
Changes from all commits
4bacd65
4e00bd3
6b4edcd
ea49a5d
744dc4e
bdf26a2
280d49e
e77fbb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,17 +13,10 @@ def respond_with(resource, _opts = {}) | |
| end | ||
|
|
||
| def respond_to_on_destroy | ||
| if current_user | ||
| render json: { | ||
| status: 200, | ||
| message: 'logged out successfully' | ||
| }, status: :ok | ||
| else | ||
| render json: { | ||
| status: 401, | ||
| message: "Couldn't find an active session." | ||
| }, status: :unauthorized | ||
| end | ||
| render json: { | ||
| status: 200, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to include the |
||
| message: 'logged out successfully' | ||
| }, status: :ok | ||
| end | ||
| # before_action :configure_sign_in_params, only: [:create] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,5 +20,5 @@ class ListItem < ApplicationRecord | |
|
|
||
| validates :book_id, presence: true | ||
| validates :user_id, presence: true | ||
| validates :rating, presence: true, numericality: { in: 1..5 } | ||
| validates :rating, presence: true, numericality: { in: 0..5 } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
can make use of |
||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #/usr/bin/env bash# exit on error | ||
| set -o errexit | ||
|
|
||
| bundle install | ||
| bundle exec rails assets:precompile | ||
| bundle exec rails assets:clean |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| uxkWVScNcve1FirRzfI5llo6u5plSZaRzKwS2we1qCtiG8LBhE9A0q2aT7Fh+OkxPdqg/ycfNrLlXhHWdLZkXG8+kNnnyGbiS66lBUPJmspR9PI0q/I6ukC1W2LM4QxVC7HDGXv1RIzUMwq6LuahLbRSqQcVMBfdtUGWRw1e6PoAlBxW1L7HKnn76SaK3oMg19WNUZwcrkr2vdnLEvrkDBt3Xo0loDXg6PyQypGWUYFEJafDwtGEtEEhXVwxBkVQJmfoRvFr3jn8yp19c8fSzqGsVrHwN8RFhQApQFmvgpj0RxGvpz2xuB2DYUFFkh+7SwY2k5alNm8yjtQW919Mel1RViT/hNYPDGVilPLGDi3gMz/HFdNUbMdJvju31bA6271ZGheUqbcqMe9wkbjjJSdbDeiGVwVHl3Wt--1WJLuUAYx4FK//Sd--YfppxPSj1PolgCC0o2r23Q== | ||
| XkmYIxn7/p5YvPqWn64w1UrKz2aAMyEITFovMBeAghv+sqKVytVci3FqOfEuyXkVS1HGPM+jGfMd3eDx5dxTvW0T2LtSliuFTjw1vePziHJq7Eo7qgFrp1TGhgSdJZUjGiBJylsp5y8lvPHd+zHVYoS9xygt4++WOWvUI4mghtYT7NkCNd8GRjZkalcbWkUSbqoZnf+ARqJeJIRTwpxHvbOWD8qo7aTijUQRF+dMjT58gQpelgDHSJF1ISstnoes8MMsky6lW0c7IYZUtofsmLBS2ZlDuKWsXV9Ai5mevIDmUG64FRFTnZp7WxKadvIEU25/BvyT/qWRcOb7TmFm7db0EPwAwHdjkoEQng9r71yVgLIxMjfWlF3vsU2r1lyuZBvPOAEaPKVE5OPaY6wv7V66vCJqy7rTvBD4--a083M/Ot7evGs44m--ncBopitz5lfsX0ntiZ2v2Q== |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,9 @@ | |
| get '/finished_books' => 'list_items#finished_books' | ||
| post '/list_item' => 'list_items#show' | ||
| post '/add_list_item' => 'list_items#create' | ||
| # post '/add_list_item' => 'list_items#add_list_item' | ||
| post '/edit_list_item' => 'list_items#update' | ||
| get '/list_item/:id/edit' => 'list_items#edit' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI you can also make use of |
||
| patch '/list_item/:id' => 'list_items#update' | ||
|
|
||
| delete '/list_item' => 'list_items#destroy' | ||
|
|
||
| get '/books' => 'books#index' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| databases: | ||
| - name: mysite | ||
| databaseName: mysite user: mysite plan: free | ||
| services: | ||
| - type: web name: mysite runtime: ruby plan: free buildCommand: "./bin/render-build.sh" | ||
| # preDeployCommand: "bundle exec rails db:migrate" # preDeployCommand only available on paid instance types | ||
| startCommand: "bundle exec rails server" envars: | ||
| - key: DATABASE_URL fromDatabase: | ||
| name: mysite | ||
| property: connectionString | ||
| - key: RAILS_MASTER_KEY | ||
| sync: false- key: WEB_CONCURRENCY | ||
| value: 2 # sensible default |
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.
Why do you need the
editendpoint? Rails already has ashowendpoint by default right?GET /list_item/:id