Skip to content

Instantly share code, notes, and snippets.

@lubyk
Created March 15, 2013 09:43
Show Gist options
  • Save lubyk/5168670 to your computer and use it in GitHub Desktop.
Save lubyk/5168670 to your computer and use it in GitHub Desktop.
class ClubsController < ApplicationController
before_filter :check_is_admin
layout :admin_layout
def club
attrs = secure(Node) { Node.transform_attributes(attrs) }
zip = attrs.delete('parent_zip')
parent = visitor.find_node(nil, zip, nil, request)
if !parent.can_write? && !visitor.exec_acl
# Try to use ACL
parent = visitor.find_node(nil, zip, nil, request) || parent
end
@node = parent.new_child(attrs, false)
if @node.save
@group = Group.create(@node.title)
@node.wgroup_id = @group.id
@node.save
end
redirect_to params[:redir] || zen_path(@node, :mode => params[:mode], :new => 'true')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment