Google Groups Home
Help | Sign in
ruote-web: could @workitem.fields_hash['params'] ever be nil?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Arjan van Bentem  
View profile
 More options May 5, 5:24 am
From: "Arjan van Bentem" <Arjan.vanBen...@bidnetwork.org>
Date: Mon, 5 May 2008 11:24:11 +0200
Local: Mon, May 5 2008 5:24 am
Subject: ruote-web: could @workitem.fields_hash['params'] ever be nil?

Is there a reason why @workitem.fields_hash['params'] could ever be nil
in ruote-web? I assume not, but if so, then WorkitemHelper::
find_partial needs a minor patch.

Why do I ask?

While experimenting with some custom forms I forgot to add hidden fields
to preserve the workflow parameters. This basically resulted in the
field 'params' to be removed (as many other fields), which is a problem
in WorkitemHelper:: find_partial which uses

    128:   activity = wi_fields['params']['activity']

Of course, one can easily add "if wi_fields['params']" or whatever, but
on the other hand: the unexpected nil saved me from a lot of trouble at
a later moment... :-)

http://github.com/jmettraux/ruote-web/tree/1c6b31fdb1ff24d181ab3724401ff
79fe2e6ec19/app/helpers/workitem_helper.rb#L128

Cheers,

Arjan.

-- John, thanks for adding ${fv:..} and ${vf:..} !


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile
 More options May 5, 5:47 am
From: "John Mettraux" <jmettr...@openwfe.org>
Date: Mon, 5 May 2008 18:47:05 +0900
Local: Mon, May 5 2008 5:47 am
Subject: Re: [openwferu-users] ruote-web: could @workitem.fields_hash['params'] ever be nil?
On Mon, May 5, 2008 at 6:24 PM, Arjan van Bentem

<Arjan.vanBen...@bidnetwork.org> wrote:

> Is there a reason why @workitem.fields_hash['params'] could ever be nil in
> ruote-web? I assume not, but if so, then WorkitemHelper:: find_partial needs
> a minor patch.

>     128:   activity = wi_fields['params']['activity']

What about something like

---8<---
    class OpenWFE::Extras::Workitem
      def params
         self.field('params') || {}
      end
    end
--->8---

?

It's true that having it break and complain can save time. (Hence not
sure about adding).

This #Lxxx trick is neat, where did you learn about it ?

> -- John, thanks for adding ${fv:..} and ${vf:..} !

You're welcome !

Best regards,

--
John Mettraux - http://jmettraux.wordpress.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arjan van Bentem  
View profile
 More options May 5, 5:52 am
From: "Arjan van Bentem" <Arjan.vanBen...@bidnetwork.org>
Date: Mon, 5 May 2008 11:52:44 +0200
Local: Mon, May 5 2008 5:52 am
Subject: RE: [openwferu-users] Re: ruote-web: could @workitem.fields_hash['params'] ever be nil?

> not sure about adding

So I assume that 'params' should indeed never be nil?

Apart from having a default or not: a method "params" might be nice
indeed, although then one might not expect "fields" to return those
params as well -- so maybe adding it would be confusing...

> This #Lxxx trick is neat, where did you learn about it ?

Errr, I just clicked on the line number in the normal view, and there it
was :-)

Arjan.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile
 More options May 5, 6:00 am
From: "John Mettraux" <jmettr...@openwfe.org>
Date: Mon, 5 May 2008 19:00:49 +0900
Local: Mon, May 5 2008 6:00 am
Subject: Re: [openwferu-users] Re: ruote-web: could @workitem.fields_hash['params'] ever be nil?
On Mon, May 5, 2008 at 6:52 PM, Arjan van Bentem

<Arjan.vanBen...@bidnetwork.org> wrote:

>  > not sure about adding

>  So I assume that 'params' should indeed never be nil?

Well, let's say that ruote-web, out of the box, assumes it will never
be nil. Please "monkey patch" Workitem (and the rest) at will in your
application. If the need becomes a pain, why not add the patch to the
core class, later.

>  > This #Lxxx trick is neat, where did you learn about it ?

>  Errr, I just clicked on the line number in the normal view, and there it
>  was :-)

Priceless, though I couldn't get it to do ranges :-(

Cheers,

--
John Mettraux - http://jmettraux.wordpress.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google