Module: Vodka::Server::Handlers::Scaffold

Included in:
VodkaController
Defined in:
lib/vodka/server/handlers/scaffold.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
# File 'lib/vodka/server/handlers/scaffold.rb', line 15

def create
  respond_with_resource(resource_class.create(filtered_params))
end

#destroyObject



24
25
26
27
28
29
# File 'lib/vodka/server/handlers/scaffold.rb', line 24

def destroy
  method = params.has_key?(:soft) ? :delete : :destroy
  resource.send(method)
  vodka_response.success = resource.destroyed?
  respond_with_resource
end

#indexObject



5
6
7
8
9
# File 'lib/vodka/server/handlers/scaffold.rb', line 5

def index
  relation = Vodka::Server::Relation.new(resource_class, params)
  vodka_response..merge!(relation.)
  respond_with_collection(relation.data)
end

#showObject



11
12
13
# File 'lib/vodka/server/handlers/scaffold.rb', line 11

def show
  respond_with_resource
end

#updateObject



19
20
21
22
# File 'lib/vodka/server/handlers/scaffold.rb', line 19

def update
  vodka_response.success = resource.update_attributes(filtered_params)
  respond_with_resource
end