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