Re: [Rails] before_action - performing an action to prevent

33 views
Skip to first unread message

Colin Law

unread,
Oct 18, 2013, 12:01:14 PM10/18/13
to rubyonra...@googlegroups.com
On 18 October 2013 13:02, Денис Чурбанов <odmin...@gmail.com> 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
Reply all
Reply to author
Forward
0 new messages