On Wed, Oct 2, 2013 at 10:41 AM, Monserrat Foster <
monse...@gmail.com> wrote:
> I'm trying to create a folder right after a user registers, so I override
> the create action on the registration controller (devise) but I don't know
> how to access the newly created user in order to create the folder with it's
> name to upload files later.
>
> So far I've got this:
>
>
> Should I leave it there or move it to the create action? Instead of using a
> method
> is that the right way to access the current user?
> Maybe instead of registration it's better to do it on sign in?
I don't know how you have your application encapsulated or even what
you consider behavior but if it were me I would skip trying to be
clever and skip trying to override methods I have no business being in
and simply hook into creation on the model:
http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html --
http://api.rubyonrails.org/classes/ActiveModel/Callbacks.html just
because it's tied to the database does not mean it's strictly an
interface between your app and the database ;).