Class: Puffer::Base

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/puffer/backends/controllers/base.rb

Direct Known Subclasses

GridBase, PufferUsersBase, TreeBase

Instance Method Summary collapse

Instance Method Details

#createObject



36
37
38
39
40
# File 'lib/puffer/backends/controllers/base.rb', line 36

def create
  @record = resource.new_member
  @record.save
  respond_with @record, :location => puffer_saving_location
end

#destroyObject



48
49
50
51
52
# File 'lib/puffer/backends/controllers/base.rb', line 48

def destroy
  @record = resource.member
  @record.destroy
  respond_with @records, :location => (request.referrer || resource.collection_path)
end

#editObject



31
32
33
34
# File 'lib/puffer/backends/controllers/base.rb', line 31

def edit
  @record = resource.member
  respond_with @record
end

#eventObject



54
55
56
# File 'lib/puffer/backends/controllers/base.rb', line 54

def event
  render :text => fields(params[:fieldset])[params[:field]].render(params[:event], self)
end

#indexObject



16
17
18
19
# File 'lib/puffer/backends/controllers/base.rb', line 16

def index
  @records = resource.collection.page(params[:page]).per(puffer_filters.per_page)
  respond_with @records
end

#newObject



26
27
28
29
# File 'lib/puffer/backends/controllers/base.rb', line 26

def new
  @record = resource.new_member
  respond_with @record
end

#showObject



21
22
23
24
# File 'lib/puffer/backends/controllers/base.rb', line 21

def show
  @record = resource.member
  respond_with @record
end

#updateObject



42
43
44
45
46
# File 'lib/puffer/backends/controllers/base.rb', line 42

def update
  @record = resource.member
  @record.update_attributes resource.attributes
  respond_with @record, :location => puffer_saving_location
end