Class: Gemgento::SubscribersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/gemgento/subscribers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/gemgento/subscribers_controller.rb', line 12

def create
  @subscriber = Subscriber.create(subscriber_params)

  respond_to do |format|
    if @subscriber.save
      format.html
      format.js { render action: 'create', layout: false }
      format.json { render json: { result: true, subscriber: @subscriber } }
    else
      format.html
      format.js { render action: 'errors', layout: false }
      format.json { render json: { result: false, errors: @subscriber.errors.full_messages } }
    end
  end
end

#newObject



6
7
8
9
10
# File 'app/controllers/gemgento/subscribers_controller.rb', line 6

def new
  @subscriber = Subscriber.new

  respond_with @subscriber
end