You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- class OrganizationController < ApplicationController
- # layout 'base_projects'
- before_filter :require_admin, :except => [:index]
-
- def index
- #@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
- @organizations = Organization.all
- respond_to do |format|
- format.html
- end
- end
-
- def new
- @organizations = Organization.new
- respond_to do |format|
- format.html
- end
- end
-
- def create
- @organizations = Organization.new
- @organizations.name = params[:organization][:name]
- if @organizations.save
- redirect_to admin_organization_url
- end
- end
-
- def edit
- @organization = Organization.find params[:id]
- respond_to do |format|
- format.html
- end
- rescue Exception => e
- render_404
- end
-
- def update
- @organization = Organization.find params[:id]
- @organization.name = params[:organization][:name]
- if @organization.save
- redirect_to admin_organization_url
- end
- rescue Exception => e
- render_404
- end
-
- def destroy
- @organization = Organization.find params[:id]
- if @organization.destroy
- redirect_to admin_organization_url
- end
- rescue Exception => e
- render_404
- end
- end
|