test for nccu
This commit is contained in:
parent
893c4686cb
commit
f2d460101f
|
@ -40,10 +40,6 @@ class Admin::NewsAdminsController < OrbitAdminController
|
||||||
redirect_to admin_news_admins_path
|
redirect_to admin_news_admins_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def unit_params
|
|
||||||
params.require(:unit).permit!
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_departments
|
def get_departments
|
||||||
unit = Unit.find(Sanitize.clean(params[:unit]))
|
unit = Unit.find(Sanitize.clean(params[:unit]))
|
||||||
departments = unit.departments.collect do |d|
|
departments = unit.departments.collect do |d|
|
||||||
|
@ -55,4 +51,10 @@ class Admin::NewsAdminsController < OrbitAdminController
|
||||||
render :json => {"departments" => departments}.to_json
|
render :json => {"departments" => departments}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def unit_params
|
||||||
|
params.require(:unit).permit!
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,14 +11,4 @@ class Unit
|
||||||
|
|
||||||
accepts_nested_attributes_for :departments, :allow_destroy => true
|
accepts_nested_attributes_for :departments, :allow_destroy => true
|
||||||
|
|
||||||
# after_save :save_departments
|
|
||||||
|
|
||||||
def save_departments
|
|
||||||
self.departments.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue