1
0
Fork 0
forked from OpenNeo/impress
impress/app/controllers/items_controller.rb

24 lines
406 B
Ruby
Raw Normal View History

2010-05-15 10:47:46 -07:00
class ItemsController < ApplicationController
2010-06-07 17:02:46 -07:00
before_filter :set_query
2010-05-15 10:47:46 -07:00
def index
if params.has_key?(:q)
begin
2010-05-15 11:14:17 -07:00
@results = Item.search(@query).alphabetize.paginate :page => params[:page]
2010-05-15 10:47:46 -07:00
rescue
2010-05-15 15:26:27 -07:00
flash.now[:alert] = $!.message
2010-05-15 10:47:46 -07:00
end
end
end
2010-05-15 17:46:41 -07:00
def show
@item = Item.find params[:id]
end
2010-06-07 17:02:46 -07:00
private
def set_query
@query = params[:q]
end
2010-05-15 10:47:46 -07:00
end