Globally remove owner/creator link ?

15 views
Skip to first unread message

Jeremy Savoy

unread,
Oct 24, 2011, 9:11:35 AM10/24/11
to Hobo Users
My app is a true multi-user app, where no user has access to another
user's data. Is there a way globally to remove the owner/creator link?

kevinpfromnm

unread,
Oct 24, 2011, 2:52:00 PM10/24/11
to hobo...@googlegroups.com
Add:

never_show :owner

to your model, assuming owner is the association name to not show.  This will remove it from all views and forms so make sure it's being set properly by a :creator => true or before_create callback.

Jeremy Savoy

unread,
Oct 24, 2011, 3:31:45 PM10/24/11
to Hobo Users
I actually already tried that Kevin ... in user.rb I have ...

has_many :contacts, :class_name => "Contact", :foreign_key =>
"owner_id", :dependent => :destroy

And in contact.rb I have ...

belongs_to :owner, :class_name => "User", :creator => true
never_show :owner

And yet the creator/owner link shows up everywhere it normally
does ... here is the HTML I get on the page ..

<a class="creator-link owner-link" href="/users/2-my-user"><span
class="view user-name ">My User</span></a>

kevinpfromnm

unread,
Oct 24, 2011, 5:09:33 PM10/24/11
to hobo...@googlegroups.com
Odd as that should take care of it.  Anyway, another approach:

<extend tag="show-page">
  <old-show-page merge without-creator-link />
</extend>

Put that in your application.dryml and it should remove the creator link from all show pages.

Jeremy Savoy

unread,
Oct 24, 2011, 9:57:39 PM10/24/11
to Hobo Users
Thanks, but what I want to do is remove the creator link from the
cards shown on the index page .. I've tried the following and it
doesn't work properly either ...

<extend tag="card" for="Contact">
<old-card: without-creator-link merge>
</old-card>
</extend>

If I try the method you mention above but extend the index-page
instead, I get an index page with the correct number of cards but with
no content in the cards at all.

Perhaps we can try and understand why never_show :owner isn't working
properly ... is this a bug or something incorrect in my application ?

kevinpfromnm

unread,
Oct 24, 2011, 10:03:10 PM10/24/11
to hobo...@googlegroups.com
If you've got that : in the old-card declaration that'd probably be why that is not working.  You want <old-card without-creator-link merge ..., it's not a parameter call.  You should also be able to drop the for="Contact" to have it apply to all cards.

Jeremy Savoy

unread,
Oct 24, 2011, 10:23:21 PM10/24/11
to Hobo Users
Thanks Kevin, as usual you've got the right answers :-)

The following worked ...

<extend tag="card">
<old-card merge without-creator-link />
</extend>

Still wondering why never_show :owner isn't working for me ...

kevinpfromnm

unread,
Oct 24, 2011, 10:43:17 PM10/24/11
to hobo...@googlegroups.com
Is owner the only User relation on that model?

Jeremy Savoy

unread,
Oct 25, 2011, 2:38:09 PM10/25/11
to Hobo Users
Yep
Reply all
Reply to author
Forward
0 new messages