maybe i'm misunderstanding your problem, but i think you need the
following in your model...

belongs_to :user, :class_name => "User"

 def create_permitted?
     acting_user.administrator?
  end

that will create a dropdown for User in the new and edit forms - so
your admin user can choose the user to assign the object to . then you
can refer to object.user elsewhere - no need to bother with
creator_id.... ?

On 9 July, 19:34, Michael Kim <[email protected]> wrote:
> Only admin creates the records, but the admin must set to a user in the
> form.  I did this because I didn't want anyone but the admin create or
> modify these.
>
> I wasn't sure about sure about number 2.  So I set up the relationship with
> :creator => true, then set creator_id in an after_filter on create and
> update?
>
> Mike
>
> On Fri, Jul 9, 2010 at 10:55 AM, erbecke <[email protected]> wrote:
> > Hi mike.
>
> > If only the admin user creates records...
>
> > 1) how do you assign a record to an existing user?
>
> > 2) Whats about changing the creator_id on the records and use
> > the :creator=>true function?
>
> > eddie
>
> > On 9 jul, 00:23, mkim <[email protected]> wrote:
> > > Hi,
>
> > > I've read some posts.  What's the best practice to get just the
> > > current_users records from a model?  I have to validate scheduling so
> > > there are no double bookings.  I have some validations that use a
> > > couple of named scopes.  A named scope wants an argument for
> > > current_user for it's lamda block.
>
> > > I wish I could use :creator => true, but all the records are created
> > > by admin.  How and where do I get the current_user?  What's the hobo
> > > or rails way?
>
> > > Mike
>
> > --
> > 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]<hobousers%[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