Finalize read only and post only categories, finished off UI work

This commit is contained in:
Sam
2013-07-16 15:44:07 +10:00
parent fce2d0e3b6
commit 352ac9e60c
18 changed files with 204 additions and 94 deletions

View File

@ -52,16 +52,18 @@ class CategoriesController < ApplicationController
[:name, :color, :text_color]
end
def category_param_keys
[required_param_keys, :hotness, :read_restricted, :permissions, :auto_close_days].flatten!
end
def category_params
required_param_keys.each do |key|
params.require(key)
end
params.permit(*category_param_keys)
if p = params[:permissions]
p.each do |k,v|
p[k] = v.to_i
end
end
params.permit(*required_param_keys, :hotness, :auto_close_days, :permissions => [*p.try(:keys)])
end
def fetch_category