mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 13:21:29 +00:00
Fix updating of custom urls
This commit is contained in:
parent
a6944cb23c
commit
f695db4bb1
2 changed files with 22 additions and 19 deletions
|
@ -35,10 +35,13 @@ class CustomUrlsController < ApplicationController
|
||||||
url = CustomUrl.find(params[:id]) rescue nil
|
url = CustomUrl.find(params[:id]) rescue nil
|
||||||
|
|
||||||
if url
|
if url
|
||||||
if url.update_attributes(params[:custom_url])
|
url.article_id = params[:custom_url][:article_id]
|
||||||
|
url.name= params[:custom_url][:name]
|
||||||
|
if url.save
|
||||||
response[:status] = 200
|
response[:status] = 200
|
||||||
response[:message] = 'Successfully updated!'
|
response[:message] = 'Successfully updated!'
|
||||||
response[:obj] = url
|
resobj = {name: url.name, title: url.article.title}
|
||||||
|
response[:obj] = resobj
|
||||||
else
|
else
|
||||||
response[:status] = 400
|
response[:status] = 400
|
||||||
message = 'Update failed! Errors:'
|
message = 'Update failed! Errors:'
|
||||||
|
|
Loading…
Reference in a new issue