go_to_param 0.0.3 → 0.0.4

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: 3cf1dbb6559624700c2d9e1ac097660437fb7adc
4
- data.tar.gz: cadc020abd194ac7494f1f0c3b06a61aec778809
3
+ metadata.gz: e85034c2269a1d8427dedad5de680834830606d5
4
+ data.tar.gz: 6733a2d52caee86fcbbf91f1be323540878d7f03
5
5
  SHA512:
6
- metadata.gz: 4835a32bad26a5078d41aec401a4c229d144176287fa85267fac01f06d0cfb628e0a83115f2362bf4497bafe38b14ef8b6e763559c8f627ae38b76d70ad1b72a
7
- data.tar.gz: 9fc842b80f29747b5144ecbe26534ce57f7f551dbbb006e857d9fb113eae94cfd4456994de1fbf9e017e5abd62aebf0f5210c11d61087049758eaf017deb5d0b
6
+ metadata.gz: 1f7b906a453c63d6b94b6b92c5a8727d03188979b2778c26b3f40544ef4cae4464cc67252984a7b681587f76bcf2a5c3072d41a51c93371778b68d9e034bec71
7
+ data.tar.gz: 5cfea1660f505122b2ffa47e39f3d850e2370630ae9ef015ebc98d4d99770db09a764bc2121bd9a3668df0ece67b329d19d97936e4ef33b62a43b96cc34b0bfa
data/README.md CHANGED
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  Now your controllers and views get some methods.
16
16
 
17
- ### get_go_to_param
17
+ ### build_go_to_hash
18
18
 
19
19
  Put the current/requested path in a `?go_to=` parameter.
20
20
 
@@ -28,7 +28,7 @@ class ApplicationController < ActionController::Base
28
28
 
29
29
  def ensure_authenticated
30
30
  unless authenticated?
31
- redirect_to login_path(get_go_to_param)
31
+ redirect_to login_path(build_go_to_hash)
32
32
  end
33
33
  end
34
34
  end
@@ -49,18 +49,18 @@ Pass the `go_to` parameter along with a form.
49
49
  </form>
50
50
  ```
51
51
 
52
- ### go_to_param
52
+ ### go_to_hash
53
53
 
54
54
  Pass the `go_to` parameter along with a link.
55
55
 
56
56
  ``` erb
57
- <%= link_to("Reset password", password_reset_path(go_to_param)) %>
57
+ <%= link_to("Reset password", password_reset_path(go_to_hash)) %>
58
58
  ```
59
59
 
60
60
  You can pass in additional parameters for the given path:
61
61
 
62
62
  ``` erb
63
- <%= link_to("Reset password", password_reset_path(go_to_param(email: @email))) %>
63
+ <%= link_to("Reset password", password_reset_path(go_to_hash(email: @email))) %>
64
64
  ```
65
65
 
66
66
  ### go_to_path
@@ -1,3 +1,3 @@
1
1
  module GoToParam
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/go_to_param.rb CHANGED
@@ -2,18 +2,18 @@ require "go_to_param/version"
2
2
 
3
3
  module GoToParam
4
4
  def self.included(klass)
5
- klass.helper_method :hidden_go_to_tag, :go_to_param
5
+ klass.helper_method :hidden_go_to_tag, :go_to_hash
6
6
  end
7
7
 
8
8
  def hidden_go_to_tag
9
9
  view_context.hidden_field_tag :go_to, go_to_path
10
10
  end
11
11
 
12
- def go_to_param(other_params = {})
12
+ def go_to_hash(other_params = {})
13
13
  { go_to: go_to_path }.merge(other_params)
14
14
  end
15
15
 
16
- def get_go_to_param
16
+ def build_go_to_hash
17
17
  if request.get?
18
18
  { go_to: request.fullpath }
19
19
  else
@@ -33,33 +33,33 @@ describe GoToParam do
33
33
  end
34
34
  end
35
35
 
36
- describe "#go_to_param" do
36
+ describe "#go_to_hash" do
37
37
  it "makes it a helper method" do
38
- FakeController.helper_methods.should include :go_to_param
38
+ FakeController.helper_methods.should include :go_to_hash
39
39
  end
40
40
 
41
41
  it "includes the go_to parameter" do
42
42
  controller.params = { go_to: "/example", id: "1" }
43
43
 
44
- controller.go_to_param.should == { go_to: "/example" }
44
+ controller.go_to_hash.should == { go_to: "/example" }
45
45
  end
46
46
 
47
47
  it "accepts additional parameters" do
48
48
  controller.params = { go_to: "/example", id: "1" }
49
49
 
50
- controller.go_to_param(a: "b").should == { go_to: "/example", a: "b" }
50
+ controller.go_to_hash(a: "b").should == { go_to: "/example", a: "b" }
51
51
  end
52
52
  end
53
53
 
54
- describe "#get_go_to_param" do
54
+ describe "#build_go_to_hash" do
55
55
  it "gets the request path as the go_to parameter" do
56
56
  controller.request = double(get?: true, fullpath: "/example")
57
- controller.get_go_to_param.should == { go_to: "/example" }
57
+ controller.build_go_to_hash.should == { go_to: "/example" }
58
58
  end
59
59
 
60
60
  it "returns an empty hash for a non-GET request" do
61
61
  controller.request = double(get?: false, fullpath: "/example")
62
- controller.get_go_to_param.should == {}
62
+ controller.build_go_to_hash.should == {}
63
63
  end
64
64
  end
65
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_to_param
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik N