I have a simple Rail 3.2 application with backbone.js front-end I have the following This works great to limit access to most actions to log in users. However, I have the data in my backbone.js archive under a main code of our main application template (halph) Is there a way to check the user's status, or is there any other way that should handle the bootstrap that a user is waiting for until he is certified? I'm not sure which part you want to execute when the user is logged in, But you can do this: For example, before_filter And the Assistant is defined on my back end:
# My first_filter is not logged in until the majority of controllers need a DEF I_user? Redirect_to '/ # login' end-end log login? !! Current_jour termination dff current_user @_current_user || = Session [: user_id] & amp; Amp; Appuser.find_by_id (session [: user_id])
& lt; Script & gt; Bootstrap with tag:
! !! % HTML {: lang = & gt; "N"}% head% title InfoUser = stylesheet_link_tag "application" ,: media = & gt; "All" = javascript_include_tag "application" = csrf_meta_tags% script $ (document) .ready (function () {App.init ();}); % Body - # layout markup: JavaScript projects.reset (# {Project.all.to_json}) groups.reset (# {Group.all.to_json}) users.reset (# {User.all.to_json}) = Render " The problem is that even if an unauthorized user accesses the app and gets redirected immediately to the login page, this bootstrapping script will still be available at the bottom of the page , And all the data in the collection is visible.
- If logged in? - # code that you want to run here
- If logged in? : Javascript $ (document) .ready (function () {App.init ();});
Comments
Post a Comment