class WebsocketController < WebsocketRails::BaseController private def authenticate? unless current_user.token == message[:token] current_redirect_to ''home/index'' false # that here we need to do to stop the further execution? end end end class WorldsController < WebsocketController before_action :authenticate? def index current_html_insert ''worlds/index'' end end From the documentation: If you call *render*, *head* or *redirect_to* from a *before_action*, the filter chain will be halted, but I have a different situation: current_redirect_to and current_html_insert - are methods of controlling the behavior of the client through websockets, they do not call methods *render*, *head* or *redirect_to. *Please tell me how can I fix this problem. -- 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 https://groups.google.com/d/msgid/rubyonrails-talk/38aa6bf1-5760-411d-8c17-4542f04af139%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On 18 October 2013 13:02, Денис Чурбанов <odmin.odin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> class WebsocketController < WebsocketRails::BaseController > > private > > def authenticate? > unless current_user.token == message[:token] > current_redirect_to ''home/index'' > false # that here we need to do to stop the further execution? > end > end > > end > > class WorldsController < WebsocketController > before_action :authenticate? > > def index > current_html_insert ''worlds/index'' > end > > end > > From the documentation: If you call render, head or redirect_to from a > before_action, the filter chain will be halted, but I have a different > situation: > current_redirect_to and current_html_insert - are methods of controlling the > behavior of the client through websockets, > they do not call methods render, head or redirect_to. > Please tell me how can I fix this problem.You have not told us what the problem is that you are trying to fix, as far as I can see. Colin -- 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 https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLucquBEFZMp0xmBt57gjk3-iZtemO4PNrSejk9eCyKHjw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
On Fri, Oct 18, 2013 at 7:02 AM, Денис Чурбанов <odmin.odin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> From the documentation: If you call render, head or redirect_to from a > before_action, the filter chain will be halted, but I have a different > situation: > current_redirect_to and current_html_insert - are methods of controlling the > behavior of the client through websockets, > they do not call methods render, head or redirect_to. > Please tell me how can I fix this problem.Render nothing (literally.) class WebsocketController < WebsocketRails::BaseController private def authenticate? unless current_user.token == message[:token] current_redirect_to ''home/index'' render :nothing => true, :status => 301 end end end -- 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 https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQnxcgtqMt%3DGwOZ4%3DMomF-Rk_maeyyvfk%2B5S7yuffO02Ccg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Thank you, this is what you need! суббота, 19 октября 2013 г., 0:07:23 UTC+4 пользователь Jordon Bedwell написал:> > On Fri, Oct 18, 2013 at 7:02 AM, Денис Чурбанов <odmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:>> > wrote: > > From the documentation: If you call render, head or redirect_to from a > > before_action, the filter chain will be halted, but I have a different > > situation: > > current_redirect_to and current_html_insert - are methods of controlling > the > > behavior of the client through websockets, > > they do not call methods render, head or redirect_to. > > Please tell me how can I fix this problem. > > Render nothing (literally.) > > class WebsocketController < WebsocketRails::BaseController > private > > def authenticate? > unless current_user.token == message[:token] > current_redirect_to ''home/index'' > render :nothing => true, :status => 301 > end > end > end >-- 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 https://groups.google.com/d/msgid/rubyonrails-talk/1c411303-3b24-4bb5-99d7-e5dbcf35ff28%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.