Class: Adhoq::QueriesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

before_action

Instance Method Details

#createObject



15
16
17
18
19
# File 'app/controllers/adhoq/queries_controller.rb', line 15

def create
  @query = Adhoq::Query.create!(query_attributes)

  redirect_to @query
end

#destroyObject



32
33
34
35
# File 'app/controllers/adhoq/queries_controller.rb', line 32

def destroy
  Adhoq::Query.find(params[:id]).destroy!
  redirect_to action: :index
end

#editObject



21
22
23
# File 'app/controllers/adhoq/queries_controller.rb', line 21

def edit
  @query = Adhoq::Query.find(params[:id])
end

#indexObject



3
4
5
# File 'app/controllers/adhoq/queries_controller.rb', line 3

def index
  @queries = Adhoq::Query.recent_first
end

#newObject



11
12
13
# File 'app/controllers/adhoq/queries_controller.rb', line 11

def new
  @query = Adhoq::Query.new
end

#showObject



7
8
9
# File 'app/controllers/adhoq/queries_controller.rb', line 7

def show
  @query = Adhoq::Query.find(params[:id])
end

#updateObject



25
26
27
28
29
30
# File 'app/controllers/adhoq/queries_controller.rb', line 25

def update
  @query = Adhoq::Query.find(params[:id])
  @query.update_attributes!(query_attributes)

  redirect_to @query
end