Displaying 20 results from an estimated 11000 matches similar to: "Questions about Chapter 9: Sign in, Sign out of RoR Tutorial | Learn Rails by Example"
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
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
Newbie learning Rails. I''m currently on Chp9 here:
http://railstutorial.org/chapters/sign-in-sign-out#top
At the end of the tutorial, rails is erroring (see below). being new
to Rails and after having checked the tutorial... How do you resolve
this kind of error. It''s saying current_user is not defined, and it is
supposed to be defined with/Sites/sample_app/app/helpers/
2012 May 12
12
before_save messing up
#user.rb ------> Model
class User < ActiveRecord::Base
attr_accessible :email, :name, :password, :password_confirmation
has_secure_password
before_save :create_remember_token
.
.
.
.
.
.
.
private
def create_remember_token
self.remember_token = SecureRandom.urlsafe_base64
end
end
#sessions_controller.rb ------->
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi,
I just installed Rails 2.0.2
[root@mymachine easyx]# ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
[root@mymachine easyrx]# gem install rails --include-dependencies
Need to update 16 gems from http://gems.rubyforge.org
................
complete
Successfully installed rails-2.0.2
[root@remandev easyrx]#
But I''m getting this error in my restful_authentication
2007 Oct 04
1
Cookies in RSpec
So how do you work with cookies properly in rspec now? I noticed in
the docs that it mentions session, assigns, and flash, but nothing of
cookie. I''m using edge rails so I''m concerned about changes to the
cookie mechanisms. I need to assign values into the cookie (a
remember token for restful authentication) so that I can have it log
in by cookie. here is my spec
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
2009 Jul 13
6
first app on Dreamhost with Passenger : "rails needs to know your username and password" ?
I am trying to deploy my first rails app with Dreamhost. I ftp''d over
my existing app, turned on Passenger and pointed it to my /public
directory. When I go to ''www.mydomain.com'' I get the ''Ruby on Rails:
Welcome aboard'' default page, including the following:
Getting started
Here’s how to get rolling:
1.
Create your databases and edit
2008 Aug 30
3
Working with sessions in beast forum
Hey,
I''m designing an app which displays the events near a user in RoR. I''m
using the beat forum to facilitate user management/sessions/etc. I''ve
edited the sessions table in the Beast database to contain a
"session_location" value and what I''d like to do is to set this to the
users location when they log in. This would allow them to change their
2008 Jan 16
5
named route new_session not working
Anyone have any idea why a named route would NOT work? I did rake
routes to make sure it was there and it was but for some reason
new_session doesn''t work.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group,
2006 Apr 03
4
Layout Question w/ code from vendor library
I am new to Ruby on Rails in general and apologize if this question is
trivial and/or has been asked before ( my searches did not turn up any
threads ).
I am using the cookies function from actionpack which I have located in
my vendor/rails/actionpack directory.
Using:
cookies[:username] and cookies[:password]
from within a controller file works just fine, I am able to set and read
2007 Feb 10
5
acts_as_authenticated strangeness
hi
the strangest thing is happening. on my local machine
acts_as_authenticated works fine, but whe on the server [dreamhost] it
refuses to log in. no error messages. nothing. just reloads the login
page again.
here`s my action:
def login
return unless request.post?
flash[:notice] = "Incorrent login"
self.current_user = User.authenticate(params[:login],
params[:password])
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
I''ve got User has_one Shop. Rails is not validating when I tried
create_shop or build_shop, neither in the browser nor the rails console.
My code:
class Shop < ActiveRecord::Base
attr_protected :user_id
belongs_to :user
validates_presence_of :name, :primary_address, :city, :country_code,
:currency
end
class ShopsController < ApplicationController
before_filter
2008 Mar 01
15
before_filter strange behaviour on update and create
Hi,
I wrote a authentication script and I''m calling it like this in every
class:
class Blah < ApplicationController
before_filter :auth
def auth
req_perm = Permission.find_by_name("Permission Blah")
access = AccessController.new()
if access.is_logged_in(session.session_id)
if
!access.get_current_user(session.session_id).role.permissions.include?
req_perm
redirect_to
2013 Jul 05
0
Sign in and sign out
Hello,
My name is Javier Molina and I am programming a simple app to manage users
in Ruby on Rails.
I read RoR Tutorial
from http://ruby.railstutorial.org/chapters/sign-in-sign-out#top to sign in
and sign out my app. I implemented the same configuration as it said:
*sessions_helper.rb*
def sign_out
self.current_user = nil
cookies.delete(:remember_token)
end
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
2007 Dec 16
2
restful_authentication: update of users' attributes on every page load upon 'Remember me' being enabled?
Hello there,
I just noticed a kinda weird thing: if users log in with the ''Remember
Me'' option enabled, their records in the db get updated everytime the
user reloads a page, because apparently restful_authentication''s code
updates the remember_token_expires_at & remember_token attributes for
each page load (not only once on the actual login (from cookie).
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
2008 Jan 08
47
specs on private methods
How does a person test private methods?
Is there a way to declare them as private, but retain any tests that
were written during the initial development?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2011 Jun 11
1
Having a problem adding a foreign key
I keep getting this exception "SQLite3::SQLException: no such
column: books.user_id: SELECT "books".* FROM "books" WHERE
("books".user_id = 4)" ,which sounds like there is no user_id in books
table.So i just installed foreigner plugin and added "
t.integer :user_id, :null => false" and
"add_foreign_key(:books, :users)" in book
2010 Apr 02
6
App_Controller and partial issues with has_many through
I have a User model, a Post model, and an Interest model:
User has_many posts through interests
User has_many interests, dependent destroy
Post has_many users through interests
has_many interests, dependent destroy
Post has_many interests
Interest belongs to Post
Interest belongs to User
Application_Controller is as follows:
class ApplicationController < ActionController::Base
before_filter