Users can now be saved with sub_roles
This commit is contained in:
1 parent
4108ebf06d
commit
afbffe37d5
16 files changed
+125
-88
No files matched your search
@@ -26,14 +26,12 @@ class Admin::RolesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
puts params.to_yaml
|
||||
@attribute = Role.new(params[:role])
|
||||
@attribute.save
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
puts params.to_yaml
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.update_attributes(params[:role])
|
||||
respond_to do |format|
|
||||
|
||||
@@ -19,16 +19,9 @@ class Admin::UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
puts params.to_yaml
|
||||
@user = User.new(params[:user])
|
||||
if @user.save
|
||||
@user.infos.each do |info|
|
||||
info.save
|
||||
info.attribute_values.each(&:save)
|
||||
end
|
||||
@user.roles.each do |role|
|
||||
role.save
|
||||
role.attribute_values.each(&:save)
|
||||
end
|
||||
flash[:notice] = t('admin.create_success_user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
@@ -66,10 +59,6 @@ class Admin::UsersController < ApplicationController
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
||||
@user.attributes.each do |ua|
|
||||
ua.attribute_values.each(&:destroy)
|
||||
ua.destroy
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to :action => :index
|
||||
|
||||
Reference in new issue
Block a user