Sha256: 715e1667174270b2a45e1d26bdb5ca6d787a4df9bbebe97c23d9afcbc993eff6
Contents?: true
Size: 852 Bytes
Versions: 3
Compression:
Stored size: 852 Bytes
Contents
class E9Crm::ContactEmailsController < E9Crm::ResourcesController defaults respond_to :js, :html def create create! do |success, failure| success.html { redirect_to :admin_sent_email } success.js { head :ok } end end protected def build_resource get_resource_ivar || begin object = if params[resource_instance_name] ContactEmail.new(params[resource_instance_name] || {}) else ContactEmail.new_from_template(template, :contact_ids => params[:uids]) end object.from_email ||= current_user.email object.valid? set_resource_ivar(object) end end # throw record_not_found if there's no template. #new requires email_template_id # be passed in params (and also contact_ids) def template @_template ||= EmailTemplate.find(params[:etid]) end end
Version data entries
3 entries across 3 versions & 1 rubygems