class Instance
instance  has_many :users    ## there should not be a user_id field in the
instances table

class User
belongs_to :instance       ## there should be a instance_id field in the
table   users table
has_many :books        ## there should not be a book_id field in the table
books table

class Book
belongs_to :users


to restrict everything just always scope , for example, then search for
users dont do

@users = User.all

instead to

@user = current_instance.users

to get a book first get the current user

@book = current_user.book.find(params[:id])

by scoping like this you will always make only abc.com user's to see their
books







On Wed, Sep 8, 2010 at 12:19 PM, Adam <[email protected]> wrote:

> On Wed, Sep 8, 2010 at 10:43 AM, nobosh <[email protected]> wrote:
>
>> Adding attr_accessible :instance_id to the model gets the value in the
>> db but the instance_id probably shouldn't be accessible as it would
>> allow another instance to possibly steal another user/instance's info,
>> right?
>
>
> You'll need to handle that through permission checking in the controller
> and validations in the model and database.
>
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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