Class: ClarkKent::UserReportEmailsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ClarkKent::UserReportEmailsController
- Defined in:
- app/controllers/clark_kent/user_report_emails_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #prepare_report_email ⇒ Object
- #prepare_user_report_email ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 10 def create @user_report_email = ClarkKent::UserReportEmail.new(user_report_email_params) if @user_report_email.save render partial: 'show_wrapper', locals: {user_report_email: @user_report_email} else render partial: 'form', locals: {user_report_email: @user_report_email}, status: 409 end end |
#destroy ⇒ Object
33 34 35 36 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 33 def destroy @user_report_email.destroy head :ok end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 23 def edit render partial: 'form', locals: {user_report_email: @user_report_email} end |
#new ⇒ Object
5 6 7 8 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 5 def new @user_report_email = ClarkKent::UserReportEmail.new(report_email_id: @report_email.id) render partial: 'form', locals: {user_report_email: @user_report_email} end |
#prepare_report_email ⇒ Object
42 43 44 45 46 47 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 42 def prepare_report_email report_email_id = params[:report_email_id] report_email_id ||= user_report_email_params[:report_email_id] if params[:user_report_email] @report_email = ClarkKent::ReportEmail.find(report_email_id) if report_email_id @report_email ||= @user_report_email.report_email if @user_report_email end |
#prepare_user_report_email ⇒ Object
38 39 40 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 38 def prepare_user_report_email @user_report_email = ClarkKent::UserReportEmail.find(params[:id]) if params[:id] end |
#show ⇒ Object
19 20 21 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 19 def show render partial: 'show', locals: {user_report_email: @user_report_email} end |
#update ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/clark_kent/user_report_emails_controller.rb', line 27 def update @user_report_email.update_attributes(user_report_email_params) @ajax_flash = {notice: "Your changes were saved."} render partial: 'show', locals: {user_report_email: @user_report_email} end |