Module: Saucy::ProjectsController::InstanceMethods
- Defined in:
- lib/saucy/projects_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/saucy/projects_controller.rb', line 19 def create @project = current_account.projects.build(params[:project]) if @project.save flash[:notice] = "Project successfully created" redirect_to project_url(@project) else render :action => :new end end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'lib/saucy/projects_controller.rb', line 46 def destroy current_project.destroy flash[:success] = "Project has been deleted" redirect_to account_projects_url(current_project.account) end |
#edit ⇒ Object
29 30 31 |
# File 'lib/saucy/projects_controller.rb', line 29 def edit current_project end |
#index ⇒ Object
52 53 54 55 |
# File 'lib/saucy/projects_controller.rb', line 52 def index @active_projects = current_account.projects.active @archived_projects = current_account.projects.archived end |
#new ⇒ Object
15 16 17 |
# File 'lib/saucy/projects_controller.rb', line 15 def new @project = current_account.projects. end |
#show ⇒ Object
42 43 44 |
# File 'lib/saucy/projects_controller.rb', line 42 def show current_project end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/saucy/projects_controller.rb', line 33 def update if current_project.update_attributes params[:project] flash[:success] = 'Project was updated.' redirect_to account_projects_url(current_account) else render :action => :edit end end |