The first solution that comes in my mind:
class PostsController < ApplicationController
before_filter :authenticate_user!, only: [:create, :update, :destroy]
def authenticate_user!
session[:post] = params[:post] unless user_signed_in?
super
end
...
end
... and then you check if session[:post] is present, clear and store post.
Il giorno giovedì 14 febbraio 2013 13:05:14 UTC+1, oto iashvili ha
scritto:>
> hi
>
> I use devise and cancan
>
> my model
>
> class PostsController < ApplicationController
> before_filter :authenticate_user!, only: [:create, :update, :destroy]
> ...
> end
>
> so an unauthentificate user can access new post form. Now when
> unauthentificate user submit new or edit forms, he is redirected to login
> form. But when he logs in, his post is not save in database. Is there
> anythings to do such as callback if I want the post to be saved ?
>
> thanks
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
groups.google.com/d/msg/rubyonrails-talk/-/aFOulOapwfgJ.
For more options, visit groups.google.com/groups/opt_out.