Skip to content

Commit

Permalink
Default value for :user_for_paper_trail method should try to return a…
Browse files Browse the repository at this point in the history
…n id instead of an object. close #316
  • Loading branch information
batter committed Feb 11, 2014
1 parent 6893431 commit c075559
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
@@ -1,6 +1,8 @@
## 3.0.1 (Unreleased)

- [#313](https://github.com/airblade/paper_trail/pull/313) - Make the rails controller helper compatible with
- [#316](https://github.com/airblade/paper_trail/issues/316) - `user_for_paper_trail` should default to `current_user.try(:id)`
instead of `current_user` (if `current_user` is defined).
- [#313](https://github.com/airblade/paper_trail/pull/313) - Make the `Rails::Controller` helper compatible with
`ActionController::API` for compatibility with the [`rails-api`](https://github.com/rails-api/rails-api) gem.

## 3.0.0
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/app/controllers/application_controller.rb
Expand Up @@ -7,7 +7,7 @@ def rescue_action(e)

# Returns id of hypothetical current user
def current_user
153
@current_user ||= OpenStruct.new(:id => 153)
end

def info_for_paper_trail
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/app/controllers/test_controller.rb
@@ -1,5 +1,5 @@
class TestController < ActionController::Base
def current_user
Thread.current.object_id
@current_user ||= OpenStruct.new(:id => Thread.current.object_id)
end
end
2 changes: 1 addition & 1 deletion test/functional/modular_sinatra_test.rb
Expand Up @@ -12,7 +12,7 @@ class BaseApp < Sinatra::Base
end

def current_user
'foobar'
@current_user ||= OpenStruct.new(:id => 'foobar')
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/functional/sinatra_test.rb
Expand Up @@ -12,7 +12,7 @@ class Sinatra::Application
end

def current_user
'raboof'
@current_user ||= OpenStruct.new(:id => 'raboof')
end

end
Expand Down

0 comments on commit c075559

Please sign in to comment.