Created
October 19, 2013 17:30
-
-
Save LeoAdamek/7058861 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OrganizationsController < ApplicationController | |
| before_filter :authenticate_user! , except: [:index , :show] | |
| def index | |
| @organizations = Organization.all | |
| end | |
| def show | |
| @organization = Organization.friendly.find(params[:id]) | |
| end | |
| def new | |
| @organization = Organization.new if not @organization.is_a?(Organization) | |
| end | |
| def create | |
| # Do some stuff to the params[:organization][:tags] | |
| params[:organization][:tags] = params[:organization][:tags].gsub("+"," ").split(",") | |
| @organization = Organization.new | |
| @organization.update_attributes! organization_params | |
| @organization.user = current_user | |
| if @organization.save then | |
| redirect_to @organization | |
| end | |
| end | |
| def edit | |
| end | |
| def destroy | |
| end | |
| private | |
| def organization_params | |
| params.required(:organization).permit( :name , :tags , :description ) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment