Sha256: b6548a5e90d6a4bccab13159bb33ea5b0545609f244969e42c9c4030e3c01974
Contents?: true
Size: 1.7 KB
Versions: 30
Compression:
Stored size: 1.7 KB
Contents
class ClarkKent::UserReportEmailsController < ClarkKent::ApplicationController before_filter :prepare_user_report_email before_filter :prepare_report_email 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 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 def show render partial: 'show', locals: {user_report_email: @user_report_email} end def edit render partial: 'form', locals: {user_report_email: @user_report_email} end 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 def destroy @user_report_email.destroy render nothing: true end def prepare_user_report_email @user_report_email = ClarkKent::UserReportEmail.find(params[:id]) if params[:id] end 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 protected def user_report_email_params params[:user_report_email].permit(:user_id, :report_email_id, :email) end end
Version data entries
30 entries across 30 versions & 1 rubygems