lib/table_setter/app.rb in table_setter-0.1.11 vs lib/table_setter/app.rb in table_setter-0.2.0
- old
+ new
@@ -10,22 +10,22 @@
enable :static
not_found do
show :"404"
end
-
+
error do
show :"500"
end
-
+
get "/" do
headers['Cache-Control'] = "public, max-age=#{TableSetter::App.cache_timeout}"
last_modified Table.fresh_yaml_time
show :index, :tables => Table.all
end
-
- ["/:slug/:page/", "/:slug/"].each do |path|
+
+ ["/:slug/:page", "/:slug"].each do |path|
get path do
headers['Cache-Control'] = "public, max-age=#{TableSetter::App.cache_timeout}"
not_found unless Table.exists? params[:slug]
table = Table.new(params[:slug], :defer => true)
last_modified table.updated_at
@@ -33,16 +33,16 @@
page = params[:page] || 1
table.paginate! page
show :table, :table => table, :page => page
end
end
-
+
private
-
+
def show(page, locals={})
erb page, {:layout => true}, locals
end
-
+
class << self
attr_accessor :cache_timeout
def cache_timeout
@cache_timeout || 0
\ No newline at end of file