publishable_transitions_for current_user broken
Reported by Ronny Hanssen | May 16th, 2011 @ 07:08 AM
I have continously upgraded my hobo 1.0 app to match hobo 1.3. I just ow upgraded it to use pre31 (and after that to RC1). I have renamed all User references to UserBase where applicable, so I think that part is ok. I however get an error when the app tries to execute some of my view code. The error looks like this:
wrong argument type User (expected Module)
Extracted source (around line [#1](/projects/8324/tickets/1 "Ticket #1")):
1: <index-page without-content-header without-new-link>
2: <before-top-page-nav:>
3: <job-scope-selectors/>
4: <job-order-selector/>
Rails.root: C:/dev/Flexy/DJBM2
Application Trace | Framework Trace | Full Trace
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/actions.rb:44:in `include?'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/actions.rb:44:in `publishable_by'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/actions.rb:53:in `acting_user_is?'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/actions.rb:15:in `available_to_acting_user?'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/actions.rb:103:in `can_run?'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/lifecycle.rb:147:in `block (2 levels) in available_transitions_for'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/lifecycle.rb:147:in `select'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/lifecycle.rb:147:in `block in available_transitions_for'
hobo (1.3.0.pre31) lib/hobo/model/permissions.rb:166:in `with_acting_user'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/lifecycle.rb:146:in `available_transitions_for'
hobo (1.3.0.pre31) lib/hobo/model/lifecycles/lifecycle.rb:152:in `publishable_transitions_for'
app/views/taglibs/application.dryml:233:in `block (3 levels) in card__for_job_with_acb80d5b0f6a'
...
The actual code in application.dryml around line 233 looks like this:
this.lifecycle.publishable_transitions_for(current_user).each do |t|
I was asked on the group to do some bug-hunting myself, but I am not that seasoned in the hobo source and have been unable to trace out where the problem actually resides. I can see that commit https://github.com/tablatom/hobo/commit/3d19d5ce72db981083e241e5a27... does change the lifecycle.publishable_transitions_for method, but I cannot see why this commit should break the functionality. From the error-message it seems like I am am really sending in a User (which I guess is expected?), whereas the metlifecycle.publishable_transitions_for complains that it expects a Module. Which means that either current_user or lifecycle.publishable_transitions_for is broken. current_user passes a User (which maybe should have been a UserBase after the rewrites?) or the lifecycle.publishable_transitions_for should handle the argument from current_user.
Comments and changes to this ticket
-
Domizio Demichelis May 16th, 2011 @ 09:27 AM
- State changed from new to open
Hi Ronny, please, could you provide a minium (new created) bare app that reproduces the problem? Thanks.
-
Domizio Demichelis May 16th, 2011 @ 07:35 PM
- State changed from open to invalid
ah... I understand the source of your problem now. :-)
Yes, that is how it is intended to be. The change to UserBase has been introduced exactly to allow the user to type just "User" as the available_to parameter (so avoiding the "::").
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป