On Jueves, 29 de Octubre de 2009 15:13:14 gs84 escribió:
> Thanks you very much Sergio, it works.
>
> But I have another question: in my application, people can leave
> comments on services they have used. So i want if someone leave a
> comment, the author (or user_id) to be set automatically from
> current_user login.
>
> I have tried to use a before_filter method, but it still not working.
>
> Thanks in advance for your help.

ActiveScaffold sets current_user to the models, so you can set the author in a 
before_save (before_create if you want to set it only in creation). If you 
want to do in the controller, you can define before_create_save and 
before_update_save methods, they get the record as a parameter.

>
> On 29 oct, 10:01, Sergio Cambra <[email protected]> wrote:
> > Try changing :services with :service_ids, and add :name => 'record
> > [services][]' to the last hash.
>
> 
-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]


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

Reply via email to