Class: Kaui::AccountEmailsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/kaui/account_emails_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /account_emails POST /account_emails.json



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/kaui/account_emails_controller.rb', line 28

def create
  @account_email = AccountEmail.new(params[:account_email])

  respond_to do |format|
    if @account_email.save
      format.html { redirect_to kaui_engine.(@account_email), :notice => 'Account email was successfully created.' }
      format.json { render :json => @account_email, :status => :created, :location => @account_email }
    else
      format.html { render :action => "new" }
      format.json { render :json => @account_email.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /account_emails/1 DELETE /account_emails/1.json



44
45
46
47
48
49
50
51
52
# File 'app/controllers/kaui/account_emails_controller.rb', line 44

def destroy
  @account_email = AccountEmail.where(:account_id => params[:id], :email => params[:email])
  @account_email.destroy

  respond_to do |format|
    format.html { redirect_to kaui_engine.(params[:id]) }
    format.json { head :no_content }
  end
end

#newObject

GET /account_emails/new GET /account_emails/new.json



17
18
19
20
21
22
23
24
# File 'app/controllers/kaui/account_emails_controller.rb', line 17

def new
  @account_email = AccountEmail.new(:account_id => params[:account_id])

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @account_email }
  end
end

#showObject

GET /account_emails/1 GET /account_emails/1.json



5
6
7
8
9
10
11
12
13
# File 'app/controllers/kaui/account_emails_controller.rb', line 5

def show
  @account_id = params[:id]
  @account_emails = AccountEmail.where(:account_id => @account_id)

  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @account_email }
  end
end