Hi Brett,

I've already discovered that if I do:
never_show :owner
in comment.rb then it will remove the owner selector from the comment
form. However if I do this, will it prevent me from displaying the
owner field at all? As I said I'm building a blog as a way of learning
the idiosyncrasies of Hobo, and it's working out very well. The main
problems I am finding are caused when, while following the
documentation something doesn't behave as expected, or isn't laid out
for implementation by the newcomer. I really think there is a gap to
be filled here to help encourage newbies into Hobo-land, and I'm
determined to fill it! I just need to get the thing working myself
first!

The other issue I now have with the permissions system is getting more
than one field to be automatically populated, again the documentation
for the neewbie is a little hazy.

So again in my Blog app, in my comment.rb I have the line:

belongs_to :post

In post.rb I have the line:

  has_many :comments, :dependent => :destroy

As I understand it, this creates a link between the two tables (by
adding foreign keys to the tables?) so that Hobo can track comments
relative to the post they were made in, much the same as they are also
tracked by the user that made the comment.

Again the problem is a selector for this field showing up in the
create form. This time I have no problem with using:
never_show :post
to hide the field from view, as at no stage do I need the user to see
this field. However this causes a problem, because by default the
field is not populated with the name of the post. If I hide the field
from view on creation then the comments are not associated with the
appropriate post, and do not display!

Controlling these fields on update is very simple, I just do:
def update_permitted?
    acting_user.administrator? || acting_user == owner && !
owner_changed? && !post_changed?
  end
to control both the post and owner fields.

My create permission in comment.rb is:

def create_permitted?
    owner == acting_user
  end

which is obviously how the owner field is being populated, but if
belongs_to :post does not do the same thing for a field that is not
actually the user, how do I control it?



On Dec 28, 5:58 pm, Brett Nelson <[email protected]> wrote:
> I don't know if you will be able to get this to remove the dropdown
> field but it might work.
>
> class Foo < AR:Base
>    fields do
>      ...
>    end
>    never_show :abc
> end
>
> where you might use owner_id instead of abc
>
> http://groups.google.com/group/hobousers/browse_thread/thread/844a035...
--~--~---------~--~----~------------~-------~--~----~
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