File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,18 +12,19 @@ def create
1212 @file = params [ :document ]
1313 @file_name = ( Time . now . to_f * 1000 ) . to_s + '.pdf'
1414
15- # TODO: Speicherort konfigurierbar machen
1615 File . open ( '/var/www/everydocs-files/' + @file_name , 'w+b' ) { |f | f . write ( @file . read ) }
1716
1817 @folder = Folder . find ( params [ :folder ] )
1918 @state = State . find ( params [ :state ] )
20-
19+ @person = Person . find ( params [ :person ] )
20+
2121 @params = {
2222 "title" => params [ :title ] ,
2323 "description" => params [ :description ] ,
2424 "document_date" => params [ :document_date ] ,
2525 "folder" => @folder ,
2626 "state" => @state ,
27+ "person" => @person ,
2728 "document_url" => @file_name
2829 }
2930
@@ -38,7 +39,20 @@ def show
3839
3940 # PUT /documents/:id
4041 def update
41- @document . update ( document_params )
42+ @folder = Folder . find ( params [ :folder ] )
43+ @state = State . find ( params [ :state ] )
44+ @person = Person . find ( params [ :person ] )
45+
46+ @params = {
47+ "title" => params [ :title ] ,
48+ "description" => params [ :description ] ,
49+ "document_date" => params [ :document_date ] ,
50+ "folder" => @folder ,
51+ "state" => @state ,
52+ "person" => @person ,
53+ }
54+
55+ @document . update ( @params )
4256 head :no_content
4357 end
4458
You can’t perform that action at this time.
0 commit comments