Class: C2::Informant::EntriesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/c2/informant/entries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
# File 'app/controllers/c2/informant/entries_controller.rb', line 15

def create
  @entry = @source.klass.new(@source.sanitized(params))
  @entry.save
  render :json => @source.entry_as_json(@entry)
end

#indexObject



5
6
7
8
# File 'app/controllers/c2/informant/entries_controller.rb', line 5

def index
  @entries = @source.entries.offset(0).limit(12)
  render :json => @source.entries_as_json(@entries)
end

#showObject



10
11
12
13
# File 'app/controllers/c2/informant/entries_controller.rb', line 10

def show
  @entry = @source.entries.find(params[:id])
  render :json => @source.entry_as_json(@entry)
end

#updateObject



21
22
23
24
25
# File 'app/controllers/c2/informant/entries_controller.rb', line 21

def update
  @entry = @source.entries.find(params[:id])
  @entry.update_attributes(@source.sanitized(params))
  render :json => @source.entry_as_json(@entry)
end