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 32 |
# File 'lib/saucy/projects_controller.rb', line 24 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
54 55 56 57 58 |
# File 'lib/saucy/projects_controller.rb', line 54 def destroy current_project.destroy flash[:success] = "Project has been deleted" redirect_to account_projects_url(current_project.account) end |
#edit ⇒ Object
34 35 36 37 |
# File 'lib/saucy/projects_controller.rb', line 34 def edit @project = current_project set_project_account_if_moving end |
#index ⇒ Object
60 61 62 63 |
# File 'lib/saucy/projects_controller.rb', line 60 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
50 51 52 |
# File 'lib/saucy/projects_controller.rb', line 50 def show current_project end |
#update ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/saucy/projects_controller.rb', line 39 def update @project = current_project set_project_account_if_moving if @project.update_attributes params[:project] flash[:success] = 'Project was updated.' redirect_to account_projects_url(@project.account) else render :action => :edit end end |