Hi, thanks for the reply,

In a way, I do want the create action, as I want the model to be
initiated and saved when the user clicked the button, or selects the
link.

What I am having problems with is that the initiation and saving of
the Model is happening when the email is sent, but I only want this to
happen after the user has received this email,
and then clicks on the create button.

Surely if the code is written within an href, or button, then the code
shoudln't run until the specific action is selected, or does this all
get automatically run through actionmailer anyway, when the email is
sent?

Pete

On Jan 19, 8:01 pm, kevinpfromnm <[email protected]> wrote:
> when you call Model.create, it initiates and saves it.  You probably want
> Model.new though, you really don't even want that if you're looking to do it
> as a transition...
>
> I used this code in a friendship type lifecycle, to be used in the current
> context of a user:
>
> <def tag="invite-button">
>   <% target = this %>
>   <do with="&Friendship.new">
>   <form controller="friendships" lifecycle="invite" unless="&target ==
> current_user or current_user.friends('all').include?(target)">
>     <input type="hidden" name="friendship[invitee_id]" value="#{target.id}"
> />
>     <submit label="Request as Friend" />
>   </form>
>   </do>
> </def>
>
> Honestly not very good code as I really should just check permissions like
> this in the lifecycle itself.  I can't remember why but I had trouble
> getting that way to work and this got the job done.

-- 
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.

Reply via email to