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
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 23 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
47 48 49 50 51 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 47 def destroy study = study.destroy! redirect_to research_studies_path, notice: success_msg_for("clinical study") end |
#edit ⇒ Object
33 34 35 36 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 33 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
17 18 19 20 21 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 17 def new study = Study.new study render_new(study) end |
#update ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/controllers/renalware/research/studies_controller.rb', line 38 def update study = if study.update_by(current_user, study_params) redirect_to research_studies_path, notice: success_msg_for("clinical study") else render_edit(study) end end |