search for: sessionshelper

Displaying 11 results from an estimated 11 matches for "sessionshelper".

2012 May 12
12
before_save messing up
...icate(params[:session][:password]) sign_in user redirect_to user else flash.now[''error''] = ''Invalid email/password combination'' render :new end end def destroy end end #sessions_helper.rb ------> Sessions Helper module SessionsHelper def sign_in(user) cookies.permanent[:_pm] = user.remember_token current_user = user end end The problem is the cookie doesn''t get set to any value at all. It''s always nil. Thanks in advance for any assistance given. [All the code is hosted here: https://github.com/TA...
2011 Jul 30
22
Question about Helpers
Studying the RoR 3 Tutorial book by Michael Hartl and on page 345 there''s the code inside the SessionsHelper: _________________________________________________________ module SessionsHelper def sign_in(user) cookies.permanent.signed[:remember_token] = [user.id, user.sault] self.current_user = user end end __________________________________________________________ What is the purpose of "self&quot...
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
...d_in?'' app/views/layouts/_header.html.erb:6:in `_app_views_layouts__header_html_erb___1701013666_2174344740_524030'' app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__1439570095_2174436720_0'' ---- END sessions_helper.rb CODE: module SessionsHelper def sign_in(user) cookies.permanent.signed[:remember_token] = [user.id, user.salt] current_user = user end def current_user=(user) @current_user = user end def signed_in? !current_user.nil? end def sign_out cookies.delete(:remember_token) self.current_user...
2011 Jun 12
3
Problem with undefined variable current_user
Hi everyone, I''m working through the tutorial at the following link and attempting to customise/adapt the lessons for my own slightly different application. Link: Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3 Tutorial book and screencasts | by Michael Hartl <http://ruby.railstutorial.org/ruby-on-rails-tutorial-book> I''m currently trying to work
2008 Dec 11
2
restful_authentication errors
When I run [code] script/generate authenticated user --include-activation [/ code] it seems to work at first, but then it reports: " The name ''SessionsHelper'' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again " I''ve heard that having both acts_as_authenticated and restful_authentication installed at the same time can cause this error, but that'...
2011 Feb 24
1
concurrent users.
If I have: class ApplicationController < ActionController::Base protect_from_forgery before_filter RubyCAS::Filter before_filter :fetch_operator include SessionsHelper private def fetch_operator @operator ||= session[:cas_user] && Operator.find_by_uid(session[:cas_user]) log_out if @operator.nil? end end @operator is available for all controllers of my application. But If I run, for example, two instances of my application from different...
2012 Jul 19
6
Rendering Partial
I am a bit confused when coming from layout and partials. To start of I have a file called application.html.erb which has my layout such has follow <html> <head> <body> <%= render ''layouts/footer'' %> </body </html> This call a new file _footer.html.erb This file his has follow <footer class="footer"> <nav> <%=
2011 Feb 05
4
Questions about Chapter 9: Sign in, Sign out of RoR Tutorial | Learn Rails by Example
...member_token] = user.id and cookies[:remember_token] ? Session stores the cookie locally until we exit the browser and then it gets deleted whereas cookies is permanent stored even after we exit the browser? 3. In section 9.3.3 we are being introduced to the curent user with the code in the module SessionsHelper self.current_user = user Why do we use the "self"? and not just current_user since we use it as a variable object and not as an object attribute ? Or is it a way to say sessions.current_user = user ? 4. What''s the purpose of def current_user=(user) and of def current_user in li...
2013 Mar 21
3
Single page application authentication and authorization
How would I do authentication and authorization in a single page application running with Rails as the backend? Any recommendations? -- 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
2011 Jan 03
8
Heroku, needs constant AppController updates?
...n local machine. -------------- Application Controller class ApplicationController < ActionController::Base require ''date'' require ''nokogiri'' require ''open-uri'' require ''chronic'' protect_from_forgery include SessionsHelper def authenticate deny_access unless signed_in? end def find_all_events @event_searches = EventSearch.all @event_searches.each do |es| do_search(es) end end def find_one_band_events(event_id) es = EventSearch.where(:id => event_id)[0] do_search(es) end def d...
2012 Jul 17
24
Static Pages from Railcast
Hi everyone, I need several pages to be static but also modify when requested. I try following the railcast from Ryan at http://railscasts.com/episodes/117-semi-static-pages?view=comments Here what I have done!! rails g scaffold Pages name:string permanentlink:string title:string author:string access_level:string is_published:boolean meta_description:string meta_keyword:string