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
17 18 19 20 21 22 23 24 25 |
# File 'lib/saucy/projects_controller.rb', line 17 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
44 45 46 47 48 |
# File 'lib/saucy/projects_controller.rb', line 44 def destroy current_project.destroy flash[:success] = "Project has been deleted" redirect_to account_projects_url(current_project.account) end |
#edit ⇒ Object
27 28 29 |
# File 'lib/saucy/projects_controller.rb', line 27 def edit current_project end |
#index ⇒ Object
50 51 52 |
# File 'lib/saucy/projects_controller.rb', line 50 def index @projects = current_account.projects end |
#new ⇒ Object
13 14 15 |
# File 'lib/saucy/projects_controller.rb', line 13 def new @project = current_account.projects. end |
#show ⇒ Object
40 41 42 |
# File 'lib/saucy/projects_controller.rb', line 40 def show current_project end |
#update ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/saucy/projects_controller.rb', line 31 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 |