Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 76ccfe3

Browse files
committed
scaffolded rails app
1 parent 21e5e4a commit 76ccfe3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1232
-0
lines changed

‎.gitignore‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all logfiles and tempfiles.
11+
/log/*
12+
/tmp/*
13+
!/log/.keep
14+
!/tmp/.keep
15+
16+
# Ignore uploaded files in development
17+
/storage/*
18+
!/storage/.keep
19+
20+
.byebug_history
21+
22+
# Ignore master key for decrypting credentials and more.
23+
/config/master.key

‎.ruby-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-2.4.1

‎Gemfile‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.4.1'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7+
gem 'rails', '~> 5.2.2', '>= 5.2.2.1'
8+
# Use postgresql as the database for Active Record
9+
gem 'pg', '>= 0.18', '< 2.0'
10+
# Use Puma as the app server
11+
gem 'puma', '~> 3.11'
12+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
13+
# gem 'jbuilder', '~> 2.5'
14+
# Use Redis adapter to run Action Cable in production
15+
# gem 'redis', '~> 4.0'
16+
# Use ActiveModel has_secure_password
17+
# gem 'bcrypt', '~> 3.1.7'
18+
19+
# Use ActiveStorage variant
20+
# gem 'mini_magick', '~> 4.8'
21+
22+
# Use Capistrano for deployment
23+
# gem 'capistrano-rails', group: :development
24+
25+
# Reduces boot times through caching; required in config/boot.rb
26+
gem 'bootsnap', '>= 1.1.0', require: false
27+
28+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
29+
gem 'rack-cors'
30+
31+
group :development, :test do
32+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
33+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34+
end
35+
36+
group :development do
37+
gem 'listen', '>= 3.0.5', '< 3.2'
38+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
39+
gem 'spring'
40+
gem 'spring-watcher-listen', '~> 2.0.0'
41+
end
42+
43+
44+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
45+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

‎Gemfile.lock‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (5.2.2.1)
5+
actionpack (= 5.2.2.1)
6+
nio4r (~> 2.0)
7+
websocket-driver (>= 0.6.1)
8+
actionmailer (5.2.2.1)
9+
actionpack (= 5.2.2.1)
10+
actionview (= 5.2.2.1)
11+
activejob (= 5.2.2.1)
12+
mail (~> 2.5, >= 2.5.4)
13+
rails-dom-testing (~> 2.0)
14+
actionpack (5.2.2.1)
15+
actionview (= 5.2.2.1)
16+
activesupport (= 5.2.2.1)
17+
rack (~> 2.0)
18+
rack-test (>= 0.6.3)
19+
rails-dom-testing (~> 2.0)
20+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21+
actionview (5.2.2.1)
22+
activesupport (= 5.2.2.1)
23+
builder (~> 3.1)
24+
erubi (~> 1.4)
25+
rails-dom-testing (~> 2.0)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27+
activejob (5.2.2.1)
28+
activesupport (= 5.2.2.1)
29+
globalid (>= 0.3.6)
30+
activemodel (5.2.2.1)
31+
activesupport (= 5.2.2.1)
32+
activerecord (5.2.2.1)
33+
activemodel (= 5.2.2.1)
34+
activesupport (= 5.2.2.1)
35+
arel (>= 9.0)
36+
activestorage (5.2.2.1)
37+
actionpack (= 5.2.2.1)
38+
activerecord (= 5.2.2.1)
39+
marcel (~> 0.3.1)
40+
activesupport (5.2.2.1)
41+
concurrent-ruby (~> 1.0, >= 1.0.2)
42+
i18n (>= 0.7, < 2)
43+
minitest (~> 5.1)
44+
tzinfo (~> 1.1)
45+
arel (9.0.0)
46+
bootsnap (1.4.2)
47+
msgpack (~> 1.0)
48+
builder (3.2.3)
49+
byebug (11.0.1)
50+
concurrent-ruby (1.1.5)
51+
crass (1.0.4)
52+
erubi (1.8.0)
53+
ffi (1.10.0)
54+
globalid (0.4.2)
55+
activesupport (>= 4.2.0)
56+
i18n (1.6.0)
57+
concurrent-ruby (~> 1.0)
58+
listen (3.1.5)
59+
rb-fsevent (~> 0.9, >= 0.9.4)
60+
rb-inotify (~> 0.9, >= 0.9.7)
61+
ruby_dep (~> 1.2)
62+
loofah (2.2.3)
63+
crass (~> 1.0.2)
64+
nokogiri (>= 1.5.9)
65+
mail (2.7.1)
66+
mini_mime (>= 0.1.1)
67+
marcel (0.3.3)
68+
mimemagic (~> 0.3.2)
69+
method_source (0.9.2)
70+
mimemagic (0.3.3)
71+
mini_mime (1.0.1)
72+
mini_portile2 (2.4.0)
73+
minitest (5.11.3)
74+
msgpack (1.2.9)
75+
nio4r (2.3.1)
76+
nokogiri (1.10.2)
77+
mini_portile2 (~> 2.4.0)
78+
pg (1.1.4)
79+
puma (3.12.1)
80+
rack (2.0.6)
81+
rack-cors (1.0.3)
82+
rack-test (1.1.0)
83+
rack (>= 1.0, < 3)
84+
rails (5.2.2.1)
85+
actioncable (= 5.2.2.1)
86+
actionmailer (= 5.2.2.1)
87+
actionpack (= 5.2.2.1)
88+
actionview (= 5.2.2.1)
89+
activejob (= 5.2.2.1)
90+
activemodel (= 5.2.2.1)
91+
activerecord (= 5.2.2.1)
92+
activestorage (= 5.2.2.1)
93+
activesupport (= 5.2.2.1)
94+
bundler (>= 1.3.0)
95+
railties (= 5.2.2.1)
96+
sprockets-rails (>= 2.0.0)
97+
rails-dom-testing (2.0.3)
98+
activesupport (>= 4.2.0)
99+
nokogiri (>= 1.6)
100+
rails-html-sanitizer (1.0.4)
101+
loofah (~> 2.2, >= 2.2.2)
102+
railties (5.2.2.1)
103+
actionpack (= 5.2.2.1)
104+
activesupport (= 5.2.2.1)
105+
method_source
106+
rake (>= 0.8.7)
107+
thor (>= 0.19.0, < 2.0)
108+
rake (12.3.2)
109+
rb-fsevent (0.10.3)
110+
rb-inotify (0.10.0)
111+
ffi (~> 1.0)
112+
ruby_dep (1.5.0)
113+
spring (2.0.2)
114+
activesupport (>= 4.2)
115+
spring-watcher-listen (2.0.1)
116+
listen (>= 2.7, < 4.0)
117+
spring (>= 1.2, < 3.0)
118+
sprockets (3.7.2)
119+
concurrent-ruby (~> 1.0)
120+
rack (> 1, < 3)
121+
sprockets-rails (3.2.1)
122+
actionpack (>= 4.0)
123+
activesupport (>= 4.0)
124+
sprockets (>= 3.0.0)
125+
thor (0.20.3)
126+
thread_safe (0.3.6)
127+
tzinfo (1.2.5)
128+
thread_safe (~> 0.1)
129+
websocket-driver (0.7.0)
130+
websocket-extensions (>= 0.1.0)
131+
websocket-extensions (0.1.3)
132+
133+
PLATFORMS
134+
ruby
135+
136+
DEPENDENCIES
137+
bootsnap (>= 1.1.0)
138+
byebug
139+
listen (>= 3.0.5, < 3.2)
140+
pg (>= 0.18, < 2.0)
141+
puma (~> 3.11)
142+
rack-cors
143+
rails (~> 5.2.2, >= 5.2.2.1)
144+
spring
145+
spring-watcher-listen (~> 2.0.0)
146+
tzinfo-data
147+
148+
RUBY VERSION
149+
ruby 2.4.1p111
150+
151+
BUNDLED WITH
152+
1.16.4

‎README.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# README
2+
3+
This README would normally document whatever steps are necessary to get the
4+
application up and running.
5+
6+
Things you may want to cover:
7+
8+
* Ruby version
9+
10+
* System dependencies
11+
12+
* Configuration
13+
14+
* Database creation
15+
16+
* Database initialization
17+
18+
* How to run the test suite
19+
20+
* Services (job queues, cache servers, search engines, etc.)
21+
22+
* Deployment instructions
23+
24+
* ...

‎Rakefile‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module Api::V1
2+
class ItemsController < ApplicationController
3+
before_action :set_item, only: [:show, :update, :destroy]
4+
5+
# GET /items
6+
def index
7+
@items = Item.all
8+
9+
render json: @items
10+
end
11+
12+
# GET /items/1
13+
def show
14+
render json: @item
15+
end
16+
17+
# POST /items
18+
def create
19+
@item = Item.new(item_params)
20+
21+
if @item.save
22+
render json: @item, status: :created, location: @item
23+
else
24+
render json: @item.errors, status: :unprocessable_entity
25+
end
26+
end
27+
28+
# PATCH/PUT /items/1
29+
def update
30+
if @item.update(item_params)
31+
render json: @item
32+
else
33+
render json: @item.errors, status: :unprocessable_entity
34+
end
35+
end
36+
37+
# DELETE /items/1
38+
def destroy
39+
@item.destroy
40+
end
41+
42+
private
43+
44+
# Use callbacks to share common setup or constraints between actions.
45+
def set_item
46+
@item = Item.find(params[:id])
47+
end
48+
49+
# Only allow a trusted parameter "white list" through.
50+
def item_params
51+
params.require(:item).permit(:type, :name, :excerpt, :description, :url, :upvotes)
52+
end
53+
end
54+
end
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module Api::V1
2+
class ListsController < ApplicationController
3+
before_action :set_list, only: [:show, :update, :destroy]
4+
5+
# GET /lists
6+
def index
7+
@lists = List.all
8+
9+
render json: @lists
10+
end
11+
12+
# GET /lists/1
13+
def show
14+
render json: @list
15+
end
16+
17+
# POST /lists
18+
def create
19+
@list = List.new(list_params)
20+
21+
if @list.save
22+
render json: @list, status: :created, location: @list
23+
else
24+
render json: @list.errors, status: :unprocessable_entity
25+
end
26+
end
27+
28+
# PATCH/PUT /lists/1
29+
def update
30+
if @list.update(list_params)
31+
render json: @list
32+
else
33+
render json: @list.errors, status: :unprocessable_entity
34+
end
35+
end
36+
37+
# DELETE /lists/1
38+
def destroy
39+
@list.destroy
40+
end
41+
42+
private
43+
44+
# Use callbacks to share common setup or constraints between actions.
45+
def set_list
46+
@list = List.find(params[:id])
47+
end
48+
49+
# Only allow a trusted parameter "white list" through.
50+
def list_params
51+
params.require(:list).permit(:title, :excerpt, :description, :upvotes)
52+
end
53+
end
54+
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /