Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4612cc91
authored
Jan 15, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updated cors and csrf settings
parent
48195675
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
3 deletions
app/controllers/application_controller.rb
app/controllers/db_folders_controller.rb
app/models/db_folder.rb
config/environments/development.rb
app/controllers/application_controller.rb
View file @
4612cc91
...
...
@@ -4,5 +4,5 @@
class
ApplicationController
<
ActionController
::
Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery
with: :
except
ion
protect_from_forgery
with: :
null_sess
ion
end
app/controllers/db_folders_controller.rb
View file @
4612cc91
...
...
@@ -7,4 +7,16 @@ class DbFoldersController < ApplicationController
render
json:
folder
,
shallow:
false
end
def
update
folder
=
DbFolder
.
find
(
params
[
:id
])
folder
.
update!
(
folder_params
)
render
json:
folder
end
private
def
folder_params
params
.
permit
(
:name
,
:description
,
:hidden
)
end
end
app/models/db_folder.rb
View file @
4612cc91
...
...
@@ -28,7 +28,7 @@ class DbFolder < ActiveRecord::Base
folder
=
super
(
except:
[
:created_at
,
:updated_at
])
if
(
options
[
:shallow
]
==
false
)
folder
[
:subfolders
]
=
subfolders
.
map
(
&
:as_json
)
folder
[
:streams
]
=
db_streams
.
map
(
&
:as_json
)
folder
[
:streams
]
=
db_streams
.
includes
(
:db_elements
,
:db_decimations
).
map
(
&
:as_json
)
end
folder
end
...
...
config/environments/development.rb
View file @
4612cc91
...
...
@@ -43,7 +43,7 @@ Rails.application.configure do
config
.
middleware
.
insert_before
0
,
Rack
::
Cors
do
allow
do
origins
'*'
resource
'*'
,
headers: :any
,
methods:
[
:get
,
:post
,
:options
]
resource
'*'
,
headers: :any
,
methods:
[
:get
,
:post
,
:options
,
:put
]
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment