-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Jim,
The lifecycle status field doesn't appear in the forms, as it should
only change during the transitions. Where you can use it is in the
field-list of the show page.
I've never used a ":init" transition, I don't know if is some Hobo
trick. I believe that if you create a new record the status should be
automatically set to "draft", and if you have transition-buttons in the
show-page you should see them.
For the old records (existing before you added the lifecycle), I would
recommend using the Rails console to mass-edit them. You can do
something like:
for record in Article.all
record.update_attribute(:status, 'draft')
end
That would set all the old records to the draft status :)
Regards,
Ignacio
El 25/08/11 18:20, Jim Harvey escribió:
> I have a model with lifecycle defined as follows:
>
> lifecycle :state_field => 'status' do
> state :draft, :default => true
> state :published
>
> transition :init, { nil => :draft }, :available_to => :all
> transition :publish, { :draft => :published }, :available_to
> => :all
> transition :unpublish, { :published => :draft }, :available_to
> => :all
> end
>
> I included the ":init" transition because all my existing data has
> status set to nil after the migration and I'm not sure how to change
> it. However, when I try to edit or create a new instance of my model
> the status field does not appear on the form even though it should, as
> far as I can tell. I've tried adding <transition-buttons /> as well
> and nothing shows up. When I try to access /init, /publish, or /
> unpublish directly I get this:
>
> That operation is not allowed
> Exception:
> #<Hobo::PermissionDeniedError: Hobo::PermissionDeniedError>
> params:
> {"controller"=>"...",
> "action"=>"publish",
> "id"=>"..."}
>
> In the console when I try to call the transition method I get:
>
> Hobo::Model::Lifecycles::LifecycleError: No transition publish
> available
>
>
> Any ideas on why this is not working would be most helpful. I'm
> probably overlooking something obvious but I've scoured the docs and
> I'm pretty much out of ideas. Thank you!
>
- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk5WhncACgkQBPlUJ6RHaOS91QCfWzhKPXl8TB9WGra6KPXA0n6P
Bc4AoIBhUdBM9G38LFEI9DBS3dDuQGeF
=tBcj
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.