Class: ProjectsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ProjectsController
- Defined in:
- app/controllers/projects_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/projects_controller.rb', line 12 def create @project = current_user.projects.build(project_params) if @project.save redirect_to root_path else render :new end end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/projects_controller.rb', line 4 def index @projects = Project.all end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/projects_controller.rb', line 8 def new @project = current_user.projects.build end |
#show ⇒ Object
22 23 24 |
# File 'app/controllers/projects_controller.rb', line 22 def show @project = Project.find params[:id] end |