Class: Renalware::Research::StudiesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Renalware::Research::StudiesController
- Includes:
- Concerns::Pageable
- Defined in:
- app/controllers/renalware/research/studies_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 28 def create study = Study.new(study_params) study if study.save_by(current_user) redirect_to research_studies_path, notice: success_msg_for("clinical study") else render_new(study) end end |
#destroy ⇒ Object
52 53 54 55 56 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 52 def destroy study = study.destroy! redirect_to research_studies_path, notice: success_msg_for("clinical study") end |
#edit ⇒ Object
38 39 40 41 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 38 def edit study = render_edit(study) end |
#index ⇒ Object
10 11 12 13 14 15 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 10 def index query = Study.ordered.ransack(params[:q]) studies = query.result.page(page).per(per_page) studies render locals: { studies: studies, query: query } end |
#new ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 22 def new study = Study.new study render_new(study) end |
#show ⇒ Object
17 18 19 20 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 17 def show study = render locals: { study: study } end |
#update ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 43 def update study = if study.update_by(current_user, study_params) redirect_to research_study_path(study), notice: success_msg_for("clinical study") else render_edit(study) end end |