Nick,

WOW! Thanks for the quick reply. I have created the relationship and I
will change my controllers to reflect your suggestion. Thanks a bunch
for the help.

On Aug 26, 10:04 am, Nicholas Henry <[email protected]> wrote:
> The simplest thing to do is create a relationship between the record
> and the user. If you object/record was product then:
>
> class Product
>   belongs_to :user
> end
>
> class User
>   has_many :products
> end
>
> then in your Product controller always access products via the user:
>
> def index
>   current_user.products
> end
>
> def new
>   current_user.products.build
> end
>
> def create
>   current_user.products.build(params[:products])
> end
>
> etc....
>
> HTH,
> Nicholas
>
> On Aug 26, 12:56 pm, mlittle <[email protected]> wrote:
>
> > I'm new to rails and I'm having problems figuring out how to limit the
> > ability to for 1 user to see the records that another user creates. I
> > have Users and Children and I want to make it so a User with user_id
> > of 1 who creates children_id of 8,9 can only see children 8,9. I also
> > want to make it so User_id 2 cannot see user_id 1 or children 8 and 9.
> > I am using restful_authentication.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to