Anthony,

You can associate my_venue model with a user and set the
view/create/delete/update permissions in the model itself , then you dont
have to do call the test current_user.signed_up in the view.

  In the model

    belongs_to :user , :creator => true

  def create_permitted?
    acting_user.administrator? || user_is?(acting_user)
  end

  def update_permitted?
    acting_user.administrator? || user_is?(acting_user)
  end

  def destroy_permitted?
    acting_user.administrator? || user_is?(acting_user)
  end

  def view_permitted?(field)
    acting_user.administrator? || user_is?(acting_user)
  end

 Im not sure about the term but i think its the 'filter' . this filter will
let then model assign to a particular "signup user"

Vivek


On Wed, Oct 31, 2012 at 10:16 PM, tonym <[email protected]> wrote:

> This one's baffled me - just can't figure out why show-index needs
> 'with="&current_user"?
> I first came across this in the agility tutorial, found a fix here and
> thought nothing of it.  But with my project, it's become a problem...
> I have all my permissions sorted in my model - admin can view all records,
> standard users view only the records they've created.
> The permissions worked fine, the views return the right records, until I
> customized the page through <show-index>
>
> <show-index> always returns blank, unless I use the 'with="&current_user"
>  (that's the fix, discuss here in another thread).
> But if I use the 'with', then the admin can only view their own records,
> thus breaking my model...  Can I get the index page up without using
> 'with', and use the rules in my model?
>
> Here's my view code...
>
> <if test="&current_user.signed_up?">
>   <index-page with="&current_user">
>    <top-page-nav: replace />
>    <bottom-page-nav: replace />
>     <collection: replace>
>       <table-plus:my_venues fields="name, venuetype, local_area,
> telephone, approval" />
>     </collection:>
>   </index-page>
> </if>
> <else>
>   <page title="No Access">
>   </page>
> </else>
> Thanks, Anthony.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/A3ZpdWAO9NYJ.
> 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.
>

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