Skip to content

Commit

Permalink
Merge branch 'master' of github.com:denispeplin/link_to_action
Browse files Browse the repository at this point in the history
  • Loading branch information
denispeplin committed Feb 27, 2013
2 parents 2091b9b + 30cb60b commit 5b5d783
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/denispeplin/link_to_action)
[![Code Climate](https://codeclimate.com/github/denispeplin/link_to_action.png)](https://codeclimate.com/github/denispeplin/link_to_action)
[![Build Status](https://secure.travis-ci.org/denispeplin/link_to_action.png)](http://travis-ci.org/denispeplin/link_to_action)
[![Gem Version](https://fury-badge.herokuapp.com/rb/link_to_action.png)](http://badge.fury.io/rb/link_to_action)

# LinkToAction

Expand Down
5 changes: 3 additions & 2 deletions lib/link_to_action/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def link_to_action_path(action, object, params)
end
end

def link_to_action_cancan?(*args)
args[0] == :back || ( LinkToAction.use_cancan ? can?(*args) : true )
def link_to_action_cancan?(action, object)
object = (object.is_a?(Array) ? Hash[*(object.last(2))] : object)
action == :back || (LinkToAction.use_cancan ? can?(action, object) : true)
end
end

Expand Down

0 comments on commit 5b5d783

Please sign in to comment.