Possible Bug in Hobo 1.3

25 views
Skip to first unread message

Arthur Baldwin

unread,
Aug 16, 2011, 12:32:09 PM8/16/11
to Hobo Users
I tried re-installing Ubuntu 11.04 on one of my machines at home and updated to the latest git repository version of Hobo 1.3 as Matt described.
Then I recreated the basic app, and created a resource called "customer" with fullname:string and address:string.
Performed the usual hobo g migration and ran rails server.
The Customers tab appears and does not crash when clicked on, since making the change Matt described to my Gemfile.  Since making the change in
app>models>customer.rb to read:

  hobo_model # Don't put anything above this

  fields do
    fullname    :string, :name => true
    address     :string
    timestamps
  end

The first screen after clicking the Customers tab does show a single line for each record with the contents of the fullname field displayed as a hyperlink.
So far so good.  Then when I click on the customer's name, the next screen should show both fields, but it does not.  Only the address field is displayed.
When I first saw this behaviour, I assumed that it was from some playing around that I did and that it was my own fault.  But after doing a fresh install at home and doing each update step carefully as well as each hobo command (with no intermediate mistakes), the problem still persists.  On the "edit screen" and the "new record screen" both fields do appear as they should.  So this problem is limited to only one screen.  I'm not sure how to name the problematic screen, but it comes up after clicking on any customer's name.  Perhaps I should call it the "show customer screen".  Anyway, this is clearly not a desirable thing for Hobo.  Just thought you'd like to know about it before the release.

Arthur

Bryan Larsen

unread,
Aug 16, 2011, 12:45:31 PM8/16/11
to hobo...@googlegroups.com
That's not a bug, it's a feature. :)

fullname is displayed in the title, so there's no need to duplicate it
in the fields.

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

Arthur Baldwin

unread,
Aug 16, 2011, 12:53:04 PM8/16/11
to hobo...@googlegroups.com
I thought that might be the intention, but that line is displayed as "Customer", not "Arthur E. Baldwin", so it's still not quite right.

Arthur


From: Bryan Larsen <br...@larsen.st>
To: hobo...@googlegroups.com
Sent: Tuesday, August 16, 2011 9:45 AM
Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3

> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>

--
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+unsub...@googlegroups.com.

Arthur Baldwin

unread,
Aug 16, 2011, 1:02:36 PM8/16/11
to hobo...@googlegroups.com
Also, the displayed URL is:


So it is aware of the correct data in a way.

Arthur


From: Arthur Baldwin <eeng...@yahoo.com>
To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
Sent: Tuesday, August 16, 2011 9:53 AM
To unsubscribe from this group, send email to hobousers+...@googlegroups.com.

Arthur Baldwin

unread,
Aug 16, 2011, 5:25:37 PM8/16/11
to hobo...@googlegroups.com
If anyone knows of another addition that I can add to the following code in order to make the "show page" display "Arthur E. Baldwin" instead of "Customer"....I would appreciate it very much if you could let me know what that syntax looks like.

fields do
   fullname    :string, :name => true
   address     :string
   timestamps
end

My wild guess is something like:

fullname   :string, :name => true, :title => true

but I could be way off....please help.

If there is no additional statement like this, then Hobo 1.3 does indeed have a bug.

Arthur
Sent: Tuesday, August 16, 2011 10:02 AM

Arthur Baldwin

unread,
Aug 16, 2011, 8:11:43 PM8/16/11
to hobo...@googlegroups.com
I would very much like to hear from an expert in regard to this problem.  At least let me know if this is considered a bug or not.
At least that way, I can focus my attention on something else until it is resolved.

Arthur

Sent: Tuesday, August 16, 2011 2:25 PM

Matt Jones

unread,
Aug 16, 2011, 8:19:10 PM8/16/11
to hobo...@googlegroups.com
This sounds like something wonky going on in the translation process - I'll take a look at it.

--Matt Jones

On Aug 16, 2011, at 8:11 PM, Arthur Baldwin wrote:

> I would very much like to hear from an expert in regard to this problem. At least let me know if this is considered a bug or not.
> At least that way, I can focus my attention on something else until it is resolved.
>
> Arthur
>

> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 2:25 PM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> If anyone knows of another addition that I can add to the following code in order to make the "show page" display "Arthur E. Baldwin" instead of "Customer"....I would appreciate it very much if you could let me know what that syntax looks like.
>
> fields do
> fullname :string, :name => true
> address :string
> timestamps
> end
>
> My wild guess is something like:
>
> fullname :string, :name => true, :title => true
>
> but I could be way off....please help.
>
> If there is no additional statement like this, then Hobo 1.3 does indeed have a bug.
>
> Arthur

> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 10:02 AM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> Also, the displayed URL is:
>
> http://localhost:3000/customers/1-arthur-e-baldwin
>
> So it is aware of the correct data in a way.
>
> Arthur
>

> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 9:53 AM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> I thought that might be the intention, but that line is displayed as "Customer", not "Arthur E. Baldwin", so it's still not quite right.
>
> Arthur
>

Arthur Baldwin

unread,
Aug 16, 2011, 8:28:35 PM8/16/11
to hobo...@googlegroups.com
Thanks Matt,

I tried using the following line:

fields do
   fullname    :string, :name => true, :primary_content => true
   address    :string
   timestamps
end

This gave me a visible "Arthur E. Baldwin" just below the Title line (underlined) but without any field name label and too far to the left.  Not exactly what I had in mind.

Arthur


From: Matt Jones <al2...@gmail.com>
To: hobo...@googlegroups.com
Sent: Tuesday, August 16, 2011 5:19 PM

> > For more options, visit this group at
> > http://groups.google.com/group/hobousers?hl=en.
> >
>
> --
> 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+unsub...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
>
>
>
> --
> 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+unsub...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
>
>
> --
> 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+unsub...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
>
>
> --
> 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+unsub...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
>
>
>
> --
> 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+unsub...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.

--
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+unsub...@googlegroups.com.

Arthur Baldwin

unread,
Aug 17, 2011, 1:04:11 PM8/17/11
to Hobo Users
While Matt is looking into the "bug" in the Customers "show page"...
Can anybody explain to me how to override the "show page" with my own design?

Arthur

Owen Dall

unread,
Aug 17, 2011, 5:14:15 PM8/17/11
to hobo...@googlegroups.com
Arthur,
 
Have you read "Rapid Rails 3 with Hobo" yet?  It is still beta, but has many examples covering Hobo 1.3 and Rails 3.
 
-Owen

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



--
Owen Dall, Chief Systems Architect
Barquin International

Arthur Baldwin

unread,
Aug 17, 2011, 6:30:05 PM8/17/11
to hobo...@googlegroups.com
Yes, I have.  But the examples don't seem applicable to my situation.  Here's what I have figured out so far:

create a folder:

app/views/customers

create a file in that directory called: show.dryml

paste in this code:

<show-page>
  <content-body:>
    <h3><Your/> Customers</h3>
    <repeat with="&@customer">
      <h4>Requirement: <a with="&this_key"/></h4>
      <collection/>
    </repeat>
  </content-body:>
</show-page>

I got this code by copying a section of the DRYML Guide, but it's not quite right.

Arthur



From: Owen Dall <od...@barquin.com>
To: hobo...@googlegroups.com
Sent: Wednesday, August 17, 2011 2:14 PM

Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3

kevinpfromnm

unread,
Aug 17, 2011, 9:22:51 PM8/17/11
to hobo...@googlegroups.com, Arthur Baldwin
Sounds like you want an index page unless each customer has_many customers somehow.

show-page is designed to show a single item + children.  @customer will be a single instance of customer model (assuming defaults), not a collection of them.

Arthur Baldwin

unread,
Aug 18, 2011, 11:55:51 AM8/18/11
to hobo...@googlegroups.com
I guess that my primary problem is not understanding the basics of ruby and rails.  I'm not interested in child records, just a single customer record with all of the fields listed with labels.  That's it.

I do learn by principles best, so if you have a suggestion of where to find a good book, let me know...maybe pick axe?

Arthur


From: kevinpfromnm <kevinp...@gmail.com>
To: hobo...@googlegroups.com
Cc: Arthur Baldwin <eeng...@yahoo.com>
Sent: Wednesday, August 17, 2011 6:22 PM

Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3

Ignacio Huerta

unread,
Aug 23, 2011, 11:57:50 AM8/23/11
to hobo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When I started with Rails I really enjoyed "Agile Development with
Rails" 3rd edition. I still consult it from time to time for the
non-hobo doubts :)

I believe the current (fourth) edition has been updated for Rails 3.

Regards,
Ignacio

El 18/08/11 17:55, Arthur Baldwin escribi�:

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

iEYEARECAAYFAk5TzfwACgkQBPlUJ6RHaOQ5HgCeOrURGxtwNEpp+Gj6gueCGBc8
EKQAnjNe/TUIcEH9cTMXcWAdSmZltswD
=LpUJ
-----END PGP SIGNATURE-----

Matt Jones

unread,
Aug 26, 2011, 11:36:17 AM8/26/11
to hobo...@googlegroups.com

On Aug 16, 2011, at 8:11 PM, Arthur Baldwin wrote:

> I would very much like to hear from an expert in regard to this problem. At least let me know if this is considered a bug or not.
> At least that way, I can focus my attention on something else until it is resolved.
>
> Arthur
>

> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 2:25 PM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> If anyone knows of another addition that I can add to the following code in order to make the "show page" display "Arthur E. Baldwin" instead of "Customer"....I would appreciate it very much if you could let me know what that syntax looks like.
>
> fields do
> fullname :string, :name => true
> address :string
> timestamps
> end

Alright, got some time to poke around and here's what I found. The generated code (from pages.dryml) looks like this:

<h2 param="heading">
<ht key="<%= model_key %>.show.heading" name="&this.respond_to?(:name) ? this.name : ''">
<name/>
</ht>
</h2>

The relevant part from the generated hobo.en.yml:

show:
title: "%{model}"
heading: "%{model} %{name}"

The first problem is that the code that sets the name attribute being passed to ht isn't nearly as general as the code that <name /> would run in the absence of a translation. (the name tag handles name_attribute correctly)

The second issue is that, even given a model that actually responds to 'name', the translation doesn't match the un-translated version since there's that extra %{model} in there.

To resolve the first problem, I think we need a new helper 'name_for':

def name_for(obj)
if (name_attr = obj.class.try_name_attribute)
obj.send(name_attr)
else
obj.try.name
end
end

This would convert the pages.dryml code to:

<h2 param="heading">
<ht key="<%= model_key %>.show.heading" name="&name_for(this)">
<name/>
</ht>
</h2>

As to the second one, that's mostly a question of style. It would match the code inside the <ht> if we changed en.hobo.show.heading to just '%{name}' - thoughts?

--Matt Jones

Ignacio Huerta

unread,
Aug 27, 2011, 10:50:35 AM8/27/11
to hobo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

For the second problem, I believe the nicest default is to keep the
"model name", because it really helps the user to know what kind of
record he is looking at.

I don't know if I understood the problem correctloy, but why don't we
use two different translation tags, instead of a combined one?

Something like:

<ht key="<%= model_key %>.show.title"></ht>
<ht key="<%= model_key %>.show.heading><name/></ht>

What do you think?

Regards,
Ignacio

El 26/08/11 17:36, Matt Jones escribi�:

- --

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/

iEYEARECAAYFAk5ZBDkACgkQBPlUJ6RHaOSfqQCdEtjZHFp31oSN+kYponwPvnQl
rbwAnjytyro8QXv9Mv6+4v2+UEf3TCpf
=VmcB
-----END PGP SIGNATURE-----

Ignacio Huerta

unread,
Aug 27, 2011, 10:54:54 AM8/27/11
to hobo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just realised:

What if we take the name of the record out of the translation?

<ht key="<%= model_key %>.show.title"></ht> <name/>

Regards,
Ignacio

El 27/08/11 16:50, Ignacio Huerta escribi�:

iEYEARECAAYFAk5ZBT4ACgkQBPlUJ6RHaORE0ACgqsnZ7nulWgMuO95viLmko6zu
xh8AnjdCoAY2p3Q3hhaZQXmkBcJ3wucl
=rvdp
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages