kuhsaft 0.2.legacy2 → 0.2.legacy3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,25 @@
1
1
  module Kuhsaft
2
2
  class PagesController < ApplicationController
3
-
3
+
4
4
  respond_to :html
5
-
5
+ before_filter :complete_url
6
+
6
7
  def show
7
8
  @page = Kuhsaft::Page.find_by_url(params[:url])
8
- respond_with @page
9
+ if @page.present?
10
+ respond_with @page
11
+ else
12
+ if respond_to?(:handle_404)
13
+ handle_404
14
+ else
15
+ raise ActionController::RoutingError.new('Not Found')
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+ def complete_url
22
+ params[:url] = "#{params[:locale]}/#{params[:url]}" if params[:url].present? && params[:locale].present?
9
23
  end
10
24
  end
11
- end
25
+ end
data/config/routes.rb CHANGED
@@ -9,5 +9,5 @@ Rails.application.routes.draw do
9
9
  end
10
10
  end
11
11
  end
12
- match '/*url' => 'kuhsaft/pages#show', :constraints => { :locale => /\w{2}/ }
12
+ match '/:locale/*url' => 'kuhsaft/pages#show', :constraints => { :locale => /\w{2}/ }
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "0.2.legacy2"
2
+ VERSION = "0.2.legacy3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- hash: 531949267
4
+ hash: 531949265
5
5
  prerelease: 4
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - legacy
10
- - 2
11
- version: 0.2.legacy2
10
+ - 3
11
+ version: 0.2.legacy3
12
12
  platform: ruby
13
13
  authors:
14
14
  - "Immanuel H\xC3\xA4ussermann"