Class: SubscribersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/subscribers_controller.rb', line 6

def create
  @subscriber = SubscribeForm.new(subscriber_params)
  @subscriber.valid? && @subscriber.submit

  params[:from] ||= params[:subscriber][:from]

  respond_to do |format|
    format.js  { render }
    format.all { redirect_to(root_path) }
  end
end

#showObject



18
19
20
21
22
23
24
25
# File 'app/controllers/subscribers_controller.rb', line 18

def show
  if params[:confirmation_token].present?
    subscribe!
    respond_with @subscriber
  else
    render_404
  end
end