new to Hobo: how to track down problem from "Name can't be blank"..

4 views
Skip to first unread message

storitel

unread,
Apr 3, 2010, 4:52:38 AM4/3/10
to Hobo Users
hi guys,
been fiddling with hobo for a few days, working through tutorials and
loving how quick it is to get the bones of an app together...

then BAM! I hit an Exception and can't figure out where to look to
identify what got broken! :(

I'm working on a simple app to assign engineers to projects... the
models are equivalent to the Recipe/Category relationship in the Rapid
Rails With Hobo book...

engineer...
has_many :projects, :through => :jobs
has_many :jobs, :dependent => :destroy

job...
belongs_to :project
belongs_to :engineer

project
has_many :engineers, :through => :jobs, :accessible => true
has_many :jobs

So on the edit page for a project I have an <Add Engineer> dropdown.
When i use it, the engineer gets added to the page OK, but when I hit
Save ... i get the exception...

ActiveRecord::RecordInvalid in ProjectsController#update

Validation failed: Name can't be blank

As far as I can see the project name, engineer name and job name are
not blank. Any guidance on where to look to track down this bug or how
to read the traces in general would be much appreciated

Paul

Matt Jones

unread,
Apr 3, 2010, 12:50:35 PM4/3/10
to hobo...@googlegroups.com

Well, posting the trace will help. :)

Posting the DRYML for the form will be handy as well; my guess is that
you've got a setup where somehow a Job is being created that doesn't
pass validation (if you set up a Project and an Engineer in the
console, does:

project.engineers << engineer

work?)

Hope this helps!

--Matt Jones

storitel

unread,
Apr 4, 2010, 4:08:04 AM4/4/10
to Hobo Users
hi Matt,
thanks for your help - you were right, the Job was being created
without a name, and i'd set :name :required.

i'm not just new to hobo... new to rails and ruby too so lots to
learn :-)

Owen Dall

unread,
Apr 4, 2010, 3:00:56 PM4/4/10
to hobo...@googlegroups.com
Keep on Truckin',  and let us know how to improve the tutorials....

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




--
Thanks,
- Owen

storitel

unread,
Apr 5, 2010, 2:16:39 AM4/5/10
to Hobo Users
Thanks for the encouragement.

I have a few thoughts on the documentation already from my strange pov
(ie new to hobo, rails and ruby... but not new to sw engineering)...

- given hobo looks like a supercharged version of rails i guess lots
of people come here withour knowing ruby or rails. it would be great
if the hobo docs could point to some key "getting started" resources
for both rails and ruby. you guys must have seen lots of
documentation, so you probably know where the best stuff is. i'm
getting there the slow way ... reading a book on ruby... then "Rails
2" awaits...

- believe it or not i only realized there *was* a console as a result
of Matt's email reply to my noob question! the console makes a big
difference for debugging, obviously :-) ... a tutorial or screencast
showing use of the console to explore the model etc could help clue
new folks in to what's going on...

- i'd really like to see info about what to do when things *don't*
work in hobo/dryml. for example I have two problems, both apparently
related to dryml tags, and so far i have no clue where to look to
solve either of them...

problem 1: i've got a <table-plus> list working, but when i click on
the column headers it doesn't sort the table - the url gets sort=
added, but the row order stays the same.

problem 2: i've put a lifecycle into my little app, following along
pretty much as in the examples... but when i add the <transition-
buttons> tag, nothing happens - no errors, no buttons.

thanks again
Paul

> > hobousers+...@googlegroups.com<hobousers%2Bunsu...@googlegroups.com>

atmorell

unread,
Apr 5, 2010, 6:02:04 AM4/5/10
to Hobo Users
http://railscasts.com/ is a great place to start if you are new to
rails/ruby. Please check if the screencast has been updated if it is a
old version. There is a lot of examples and even a console and
debugging tutorial ;)

http://railscasts.com/episodes/48-console-tricks
http://railscasts.com/episodes/54-debugging-with-ruby-debug

Google is your friend for finding rails documentation. Just search e.g
"rails validation" and look for the link starting with
api.rubyonrails.org/...

If you are having a problem that you can't solve and won't ask it in
the hobo forum try to stackoverflow.com - this is a great rails,
ruby, database, + forum.


Best regards.
Asbjørn Morell

Owen

unread,
Apr 5, 2010, 9:13:34 AM4/5/10
to Hobo Users
I will add those links to a new "Ruby and Rails Resources" page in the
next version. See the following to add suggestions and errata:

https://barquin.lighthouseapp.com/projects/47780-rapid-rails-with-hobo-book-requests-and-errata/overview

On Apr 5, 6:02 am, atmorell <atmor...@gmail.com> wrote:
> http://railscasts.com/is a great place to start if you are new to


> rails/ruby. Please check if the screencast has been updated if it is a
> old version. There is a lot of examples and even a console and
> debugging tutorial ;)
>

> http://railscasts.com/episodes/48-console-trickshttp://railscasts.com/episodes/54-debugging-with-ruby-debug

Bryan Larsen

unread,
Apr 5, 2010, 9:57:10 AM4/5/10
to hobo...@googlegroups.com
storitel wrote:
> Thanks for the encouragement.
>
> I have a few thoughts on the documentation already from my strange pov
> (ie new to hobo, rails and ruby... but not new to sw engineering)...

Which I don't think is uncommon in this community.


>
> - given hobo looks like a supercharged version of rails i guess lots
> of people come here withour knowing ruby or rails. it would be great
> if the hobo docs could point to some key "getting started" resources
> for both rails and ruby. you guys must have seen lots of
> documentation, so you probably know where the best stuff is. i'm
> getting there the slow way ... reading a book on ruby... then "Rails
> 2" awaits...

OK, I've created a ticket
https://hobo.lighthouseapp.com/projects/27184-hobo-cookbook/tickets/21-add-manual-section-with-pointers-to-resources-for-rails-ruby
to add a section to the manual. People can add resources by commenting
on that ticket or just commenting in this thread.

Another location is this older ticket:
https://hobo.lighthouseapp.com/projects/8324/tickets/443-faq which talks
about creating an FAQ for hobocookbook.

>
> - i'd really like to see info about what to do when things *don't*
> work in hobo/dryml. for example I have two problems, both apparently
> related to dryml tags, and so far i have no clue where to look to
> solve either of them...
>
> problem 1: i've got a <table-plus> list working, but when i click on
> the column headers it doesn't sort the table - the url gets sort=
> added, but the row order stays the same.

OK, that definitely qualifies as a bug in the documentation. Sort
requires controller support. If you can't figure it out from the
agility example, post back. I opened a ticket to make sure we add the
docs before 1.1.


>
> problem 2: i've put a lifecycle into my little app, following along
> pretty much as in the examples... but when i add the <transition-
> buttons> tag, nothing happens - no errors, no buttons.

This is most likely a problem in your :available_to options on your
transitions. Sometimes it's helpful to use transition-button rather
than transition-buttons because it may give error messages rather than
silently omitting invalid transitions.

Bryan

Owen Dall

unread,
Apr 5, 2010, 10:46:07 AM4/5/10
to hobo...@googlegroups.com
Thanks for the excellent suggestions. I will post these on our Lighthouse project for "Rapid Rails with Hobo".



-Owen

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.




--
Thanks,
- Owen

storitel

unread,
Apr 5, 2010, 1:41:50 PM4/5/10
to Hobo Users
thanks for the feedback and the resource links chaps - they're
definitely more useful than my average google result.... I'm
scrambling up the learning curve with your help :-)

i've solved the two dryml tags issues now, thank you. i guess i got so
excited by hobo i was expecting it all to work by magic :-)

> > <hobousers%2Bunsu...@googlegroups.com<hobousers%252Buns...@googlegroups.com>

kevinpfromnm

unread,
Apr 5, 2010, 1:50:59 PM4/5/10
to Hobo Users
http://www.ruby-doc.org/core/ ruby docs
http://api.rubyonrails.org/ rails docs

http://www.themomorohoax.com/2009/02/09/use-debugger tutorial on using
rails debugger

also some useful techniques are adding raise variable_name.inspect in
controller and <%= variable.inspect %> in views for when you just need
a quick peek at what's happening.

Reply all
Reply to author
Forward
0 new messages