Class: NoticesController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/notices_controller.rb', line 2

def index
  if params[:api_key]
    @api_key = params[:api_key]
    @notices = Notice.find_all_by_api_key(@api_key,
                                          :order => "updated_at DESC")
    render :layout => "with_feed", :action => "list_notices"
  else
    # List API keys
    res = Notice.connection.execute("SELECT DISTINCT api_key FROM notices")
    @keys = res.map {|i| i["api_key"]}
    render :action => "list_by_api_key"
  end
end

#showObject



16
17
18
# File 'app/controllers/notices_controller.rb', line 16

def show
  @notice = Notice.find(params[:id])
end