I have been testing if it's possible to use attributes of associated
objects in create_permitted? like this (just an imaginary example):

  belongs_to :resource

  def create_permitted?
    resource.building.name == 'Foo'
  end

This gives nil when trying to open up a form for creating new entries:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.building

RAILS_ROOT: /home/betelgeuse/hobotest
Application Trace | Framework Trace | Full Trace

/home/betelgeuse/hobotest/app/models/users_resource.rb:16:in
`create_permitted?'
app/views/taglibs/auto/rapid/pages.dryml:358:in
`index_page__for_users_resource'
app/views/taglibs/auto/rapid/pages.dryml:356:in
`index_page__for_users_resource'
app/views/taglibs/auto/rapid/pages.dryml:356:in
`index_page__for_users_resource'
app/views/taglibs/auto/rapid/pages.dryml:349:in
`index_page__for_users_resource'
app/views/taglibs/themes/clean/clean.dryml:2:in `page'
app/views/taglibs/themes/clean/clean.dryml:1:in `page'
app/views/taglibs/auto/rapid/pages.dryml:346:in
`index_page__for_users_resource'
app/views/taglibs/auto/rapid/pages.dryml:345:in
`index_page__for_users_resource'

Should I be able to use associations like this and I have stumbled on
a bug or is what I am trying to do invalid? This is with hobo-0.8.7. I
can write something to the manual if the associations are expected to
be nil in create_permitted?. When thinking about it for the framework
to be able to do New links properly etc it would make sense that
checking like this is not possible.
--~--~---------~--~----~------------~-------~--~----~
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