Transitions broken
Reported by Ronny Hanssen | January 16th, 2011 @ 09:08 PM | in Hobo 1.3 (Rails 3)
In one of my dryml views I had some code that looked like this for Hobo 1.0:
this.lifecycle.available_transitions_for(current_user).each do |t|
In Hobo 1.3.0.pre25 I get an error:
wrong argument type User (expected Module)
It affects the standard transition-buttons tag too. In other words, currently there is no supported way of displaying the transitions defined.
Comments and changes to this ticket
-
Domizio Demichelis January 18th, 2011 @ 11:39 AM
- State changed from new to open
- Milestone set to Hobo 1.3 (Rails 3)
- Milestone order changed from 197937 to 0
-
Domizio Demichelis January 18th, 2011 @ 12:04 PM
Hi Ronny,
this.lifecycle.available_transitions_for(current_user)
what 'this' is referring to? and what is the 'current_user' in your example?
Because, just to try it, I tried this in the console, and it worked:
>> u = User.first >> u.lifecycle.available_transitions_for(u) => [#<struct Hobo::Model::Lifecycles::Transition lifecycle=User::Lifecycle, name=:request_password_reset, start_states=[:active], end_state=:active, on_transition=#<Proc:0x0000000102f00840@/Users/dd/dev/spi2/app/models/user.rb:42>, options={:new_key=>true}>]
even when u = Guest.new
Could you give me the minimal change to put into a bare app in order to reproduce it?
Thanks -
Tiago Franco January 18th, 2011 @ 10:48 PM
Domizio, try with the attached file please. It reproduces the error when you type on the console:
CreditTransaction::Lifecycle.request User.first
-
Domizio Demichelis January 19th, 2011 @ 12:06 AM
That happens because you defined an :available_to => "User" instead using "::User", as pointed out by this wise answer.
http://groups.google.com/group/hobousers/browse_thread/thread/11535...
Thanks Tomoaki!
-
Bryan Larsen March 9th, 2011 @ 03:39 PM
- Tag changed from lifecycle, rails3 to defect, lifecycle, rails3
This bug bites in other places:
class User < ActiveRecord::Base hobo_user_model UserType = HoboFields::Types::EnumString.for("individual", "charity", "company") fields do usertype ::User::UserType end end
The "obvious solution" would be to rename Hobo::Model::User to Hobo::Model::UserMixin or something. That's a pretty significant change to be making this late in the process, but it will be impossible to do after we release 1.3.0, so maybe we should just bite the bullet?
-
Domizio Demichelis March 11th, 2011 @ 11:19 PM
- State changed from open to resolved
(from [9c64e19d0920d3456d4b243f9ff07d95efa2f30c]) Hobo::Model::User > Hobo::Model::UserBase [#904 state:resolved] https://github.com/tablatom/hobo/commit/9c64e19d0920d3456d4b243f9ff...
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 ยป
People watching this ticket
Attachments
Referenced by
- 913 available_to User now must be ::User see #904
- 904 Transitions broken (from [9c64e19d0920d3456d4b243f9ff07d95efa2f30c]) Hobo::M...