params should map to attributes or columns on your model. Behind the
scenes Hobo will do something like user.given_id = params[:given_id].
In this case I don't think you need any params as the model is
already found to get to the transition
>
> to the users controller under admin
>
> def block(given_id)
>
> user = User.where(:id=>given_id)
> user.state = 'blocked'
> flash[:now] ="TEST"
> end
It's the do_block action you care about. Block is the action that
renders the block form. But Hobo should be creating a sufficient
block and do_block method for you, as long as you have auto_actions
:all or auto_actions :lifecycle in your controller. You do have one
of those, don't you?
You also aren't saving the user, so no changes are being persisted to
the database.
if you need to add code to your action you can do something like this:
def do_block
flash[:now] ="TEST"
do_transition_action :block
end
Bryan
Bryan
> --
> You received this message because you are subscribed to the Google Groups "Hobo Users" group.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to hobousers+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
>
> I went along with all your suggestions added acting, user and subsite
> params. I also deleted the custom actions hoping the context would fix
> it. I deleted the param from the button as well. Still getting
>
> Routing Error
>
> No route matches "/admin/users"
>
> after the redirect same as before. Any ideas ?
You'll need to specify the redirect path directly, since the default isn't working for you:
class Admin::UsersController < ApplicationController
auto_actions :all
def do_block
do_transition_action :block do
flash[:notice] = 'BANHAMMERED"
redirect_to :someplace
end
end
--Matt Jones