Class: Spree::QuestionsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/questions_controller.rb

Instance Method Summary collapse

Instance Method Details

#browseObject

Raises:

  • (ActionController::RoutingError)


12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/questions_controller.rb', line 12

def browse
  @taxon = Taxon.find_by_permalink!(params[:id])
  @questions = @taxon.questions.page(params[:page])
  raise ActionController::RoutingError.new('No Matching Questions') if @questions.all.empty?

  @title = "#{@taxon.name} Frequently Asked Questions"

  render :index
end

#indexObject

Raises:

  • (ActionController::RoutingError)


4
5
6
7
8
9
10
# File 'app/controllers/spree/questions_controller.rb', line 4

def index
  @questions = Question.page(params[:page])
  raise ActionController::RoutingError.new('No Matching Questions') if not params[:page].nil? and @questions.all.empty?
  
  @title = 'Frequently Asked Questions'
  @canonical_url = questions_path(:page => (not params[:page].nil? and params[:page].to_i > 1 ? params[:page] : nil))
end

#showObject



22
23
24
25
26
27
28
29
# File 'app/controllers/spree/questions_controller.rb', line 22

def show
  @question = Question.find_by_slug!(params[:id])
  
  @title = @question.question
  @description = @question.description
  
  @canonical_url = question_path(@question)
end