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
24 25 26 27 28 29 30 31 |
# File 'lib/saucy/projects_controller.rb', line 24 def create @project = current_account.projects.build(params[:project]) if @project.save redirect_to project_url(@project) else render :action => :new end end |
#destroy ⇒ Object
52 53 54 55 |
# File 'lib/saucy/projects_controller.rb', line 52 def destroy current_project.destroy redirect_to account_projects_url(current_project.account), :notice => "Project has been deleted" end |
#edit ⇒ Object
33 34 35 36 |
# File 'lib/saucy/projects_controller.rb', line 33 def edit @project = current_project set_project_account_if_moving end |
#index ⇒ Object
57 58 59 60 |
# File 'lib/saucy/projects_controller.rb', line 57 def index @active_projects = current_account.projects.active @archived_projects = current_account.projects.archived end |
#new ⇒ Object
17 18 19 20 21 22 |
# File 'lib/saucy/projects_controller.rb', line 17 def new @project = current_account.projects. if @project.keyword.blank? @project.keyword = 'keyword' end end |
#show ⇒ Object
48 49 50 |
# File 'lib/saucy/projects_controller.rb', line 48 def show current_project end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/saucy/projects_controller.rb', line 38 def update @project = current_project set_project_account_if_moving if @project.update_attributes params[:project] redirect_to account_projects_url(@project.account), :notice => 'Project was updated.' else render :action => :edit end end |