On Wed, May 5, 2010 at 10:57 AM, Chris Apolzon <[email protected]> wrote:
> Matt-
>   I can't begin to thank you enough for your feedback.  Working on my first
> major rails project as the sole developer (and not a single minute of Ruby
> experience anywhere else in the office) makes it extremely difficult to get
> good feedback.
> I love your nav-item-with-count tag and I removed the ||= in my controller
> logic.  Would it make sense to change any of those instance variables to a
> normal ruby variable?  Or would I need to do some cache checks in that case
> to make sure I didn't serve stale data?

No worries about stale data - instance variables don't persist past
the end of the current request.

> I have run into a couple issues in the nav-item-with-count tag, though.
> First, the link_text assignment isn't correct as the empty tag case
> (<nav-item-with-count status="something"/>) parameters.default returns ""
> which overrides the || status chunk. (Easily fixable)

I always forget whether that returns blank or nil. D'oh! :)

> The other issue is Manuscript.send("status_name") returns undefined method
> "status_name".  I will eventually be implementing these as lifecycles; is
> this one of the things I'll get for free when I switch over to a lifecycle?
>  I'm working on a short-term fix, but I'm not really sure how that line was
> supposed to work originally.

The idea of that line is that a lifecycle will give you named_scopes
that match the names of the lifecycle states. So if you've got a
lifecycle state 'seeking_reviewers', then:

Manuscript.seeking_reviewers

returns a scope proxy for Manuscripts that are in that state. The
proxy acts much like the object returned by an association, so calling
'count' on it won't actually load all the manuscripts, but instead
generates a SQL query to get the count directly. The purpose of using
'Manuscript.send(status)' is to dynamically call the method whose name
is in the status variable.

--Matt Jones

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