recruiter 1.1.12 → 1.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25d77e298d3c285b9ddd5a816d38038a3c0afacc
4
- data.tar.gz: 0c91e7ae3d7c5f8f0415b990d6a5332974557ff4
3
+ metadata.gz: 7f723a9409d2d83de14c6099d6c42c74df76ec50
4
+ data.tar.gz: f9552b7b4a7e139cb7f9e053ef5dd7de2d954433
5
5
  SHA512:
6
- metadata.gz: 0111042a4692dc51840485d6032bce32c7a35aac50f792b562e7ef3e3576622b7f20ac7803c0f65d15ffbf5b8c0ec5e5ebc4d646ebe12c4561a236e6aa1c6bef
7
- data.tar.gz: b8b1db2746b33f6030eef1bcf061fb59d02736af9055cd8a455185e926e17d30e416851ed2a82ee59f89aa0719daf4a45f98807a4f060afaed4737d3abfba63d
6
+ metadata.gz: 75b0a05c1cf14618e2931bbf216f737ca191ed04804c69450b386a98436540c751694588b893d4bd9b2c5f5d49b97cc9b5aebde69b33eee338d26b777450fc41
7
+ data.tar.gz: 9564bb9810255d27e4fe4348fb9aa643370cfa131b88d81e80fc6228a76ae46b380b00820a72585a360641a14f9db3f6fff7cb8ba4518f5b65f18db793da5150
@@ -1,5 +1,5 @@
1
1
  module Recruiter
2
- class ArticlesController < ApplicationController
2
+ class ArticlesController < ::RecruiterController
3
3
  respond_to :html, :json
4
4
 
5
5
  def index
@@ -9,7 +9,9 @@ module Recruiter
9
9
 
10
10
  def show
11
11
  @article = scope.find(params[:id])
12
- respond_with(@article)
12
+ ensure_canonical_url(@article) do
13
+ respond_with(@article)
14
+ end
13
15
  end
14
16
 
15
17
  private
@@ -11,7 +11,9 @@ module Recruiter
11
11
 
12
12
  def show
13
13
  @job = Job.find(params[:id])
14
- respond_with(@job)
14
+ ensure_canonical_url(@job) do
15
+ respond_with(@job)
16
+ end
15
17
  end
16
18
 
17
19
  private
@@ -3,6 +3,8 @@ class RecruiterController < ApplicationController
3
3
 
4
4
  layout 'recruiter/application'
5
5
 
6
+ protected
7
+
6
8
  def page
7
9
  params[:page]
8
10
  end
@@ -10,4 +12,15 @@ class RecruiterController < ApplicationController
10
12
  def per_page
11
13
  params[:per_page]
12
14
  end
15
+
16
+ def ensure_canonical_url(model, &block)
17
+ canonical_url = url_for(model)
18
+
19
+ if canonical_url.to_s == request.original_url.to_s
20
+ instance_eval(&block)
21
+ return
22
+ end
23
+
24
+ redirect_to canonical_url
25
+ end
13
26
  end
@@ -5,6 +5,7 @@ module Recruiter
5
5
  validates :user, presence: true
6
6
  validates :body, presence: true
7
7
 
8
+ default_scope ->{ order('updated_at DESC') }
8
9
  scope :published, ->{ where(published: true) }
9
10
 
10
11
  def to_param
@@ -1,3 +1,3 @@
1
1
  module Recruiter
2
- VERSION = "1.1.12"
2
+ VERSION = "1.1.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recruiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.12
4
+ version: 1.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-15 00:00:00.000000000 Z
11
+ date: 2015-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari