similar to: Updating only one field

Displaying 20 results from an estimated 2000 matches similar to: "Updating only one field"

2003 Feb 19
3
removing leading/trailing blanks
Hi, What's the best way of dropping leading or trailing blanks from a character string? The only thing I can think of is using sub() to replace blanks with null strings, but I don't know if there is a better way (I also don't know how to represent the trailing blank in a regular expression). Thanks, Doug Grove
2006 Mar 13
7
Problem with params
I''ve got a User model, which holds the following (excerpt): def try_to_authenticate User.authenticate(self.username, self.password) end .. private def self.hash_password(password) Digest::SHA1.hexdigest(password) end def self.authenticate(username, password) @user = User.find(:all, :conditions => ["username = ? AND password = ?",
2006 Jun 27
1
user.save now workie, but user.update_attributes does
In my User model, I had this: def update_last_login_time self.last_login = Time.now self.save end But last_login was not being set. When I changed it to this it worked: self.update_attribute( :last_login, Time.now ) Any ideas why? ~S
2006 Mar 29
5
How to skip password validation when updating other fields?
Besides the hashed password, which is saved to db, I have two password-attributes in my User model: attr_accessor :password, :password_confirmation I have validations on these attributes, and I need them to work both on create and update, since I have pages for changing and resetting the password. Now when I want to update just the user''s login name, I guess I have the next
2006 Feb 27
4
update_attribute with Validation?
Does anyone know of a way to update individual attributes with validation? update_attribute disables the validation checks in the record model, so I''m wondering if there''s a workaround for this. In my application, I want to allow the user to update some or all the attributes without having to enter :password and :password_confirmation, both of which are subject to
2006 Aug 14
2
Change password
Is there an addition to the Rails Recipe or the method in AWDWR to allow a user to change his/ her password? I have put something together that does all the work again - mostly because I''m not sure how to leverage on methods like ''password='' that are defined in the model. Has anyone got a ready sample that I could learn from? Right now, I''m basically
2006 Mar 16
6
Sessions or lookups?
My application needs to know if a user is an administrator, for security and aesthetic reasons. At the moment, I store true/false in the session by doing the following at login: session[:user_is_admin] = authenticated_user.is_admin? Is this OK to do? Or should I really be doing the following every time: User.find(session[:user_id]).is_admin? (user_id is always in the session too) Is there
2007 Nov 17
18
Syntax Problem
I admit I am stuck. I am converting a legacy php site to ROR. The old site uses MD5, a security flaw waiting to happen. I upgraded to AAA and am adding code in the session_controller.rb file to see if crypted_password is blank. If it is, crypt and check the password against the old md5 version and write it in the new crypted_password field. Here is my code add on before the logged_in?: def
2006 Apr 14
3
Am I doing this right?
Hi everyone, I am following along with the book and branched out a bit to try some stuff on my own. I''ve been working on is a basic user management system - create a user, log in, log out, update your account, that sort of thing. I created a password changer that compares the old password (oldpw) against what''s currently in the database, then updates that record with the
2006 Jun 21
5
model with not te be updated attributes ?
Hi List, I have a table that contains several fields that must be initialized when first created, but may not be altered afterwards (when updating the other fields) because they can be changed by external processes. I noticed that the ActiveRecord update commands (even update_attribute) only seem to work by loading the complete record, changing fields that need to be changed and doing a full
2006 Jul 04
1
LoginGenerator Problem
I am trying to make a barebones login system based on this example (which in turn is just standard RoR login) but when I enter a user name and password, it says the login is unsuccessful every time. I am not sure where I am going wrong. Here is all relevent information CREATE TABLE `users` ( `id` int(6) unsigned NOT NULL auto_increment, `login` varchar(20) NOT NULL default
2006 Aug 30
3
extracting username
Forgive my ignorance ya''ll. I''m trying to extract a username from a table using the user id. I''ve tried: @authenticated_user = User.find(:first, :select => "login", :conditions => "id = ''1''") AND: @authenticated_user = User.find_by_sql("select login from users where id=''1''") within an action that
2007 Oct 01
3
stringify_keys!
I have seen this numerious times and still have no idea what it means: undefined method `stringify_keys!'' for "blah22":String I am tring to change a password. My code looks like: def change_password @user = User.find_by_emailaddr( params[:email] ) if @user.nil? # user profile not created flash[:notice] = "<b style = \"color:red\">No such
2007 Dec 12
1
why is authenticate_with_http_basic undefined?
Hi, i used the rick olson''s restful_authentication plugin rails 1.2.6 i wanted to check for authenticated user so i wrote this in my application.rb # Filters before_filter :authenticate # Sets @authenticated_user if the user provides valid # credentials. May be used to deny access or customise the view def authenticate @authenticated_user = nil
2006 May 04
9
Help: wrong number of arguments (0 for 1)
Is it my environment? Is something wrong, cause I thought this should just work? I have a simple table and I created a model and a controller: ruby script/generate controller Restaurant ruby script/generate model Restaurant I edited the controller to this: class RestaurantController < ApplicationController scaffold :Restaurant end I run it and: http://0.0.0.0:3000/Restaurant works fine,
2006 Apr 25
5
Authorisation question
My authentication (signup/login) is up and running in my app, now I need to implement an authorisation system. Its not going to be a complex one. One admin (me) and then normal members and premium members. Any tutorials or tips on a simple way to get this running? Thanks. -- Posted via http://www.ruby-forum.com/.
2010 Apr 29
1
How can I integrate change_password plugin, dovecot and postfix
Hello I use dovecot, postfix, mysql and squirrelmail as a mail server. it works well. Meanwhile I am novice at postfix. As you know, there is a change_password plugin on squirrelmail. I wish to add change_password plugin on squirrelmail. I couldn't find how to integrate postfix and change_password. How can I add it ?
2010 Apr 29
1
How can I add change_password
Hello I use dovecot, postfix, mysql and squirrelmail as a mail server. it works well. Meanwhile I am novice at postfix. As you know, there is a change_password plugin on squirrelmail. I wish to add change_password plugin on squirrelmail. I couldn't find how to integrate postfix and change_password. How can I add it ?
2006 May 15
5
Login generator errors.
Okay, I download login generator and I used it on my new app but, it''s not working correctly. If the user logins on the same session as he created he will login if it isn''t the same session it fails. What''s going on? -- Posted via http://www.ruby-forum.com/.
2006 Apr 03
7
Getters and setters problem?
Hi list, first evening of playing with rails, so please forgive me if I ask something stupid. ;-) I created a User model and tried to use ActiveRecord callbacks to convert the password to sha1 just before saving it. For some reason postgresql gives me a error because the given password is null. To test even further I tried to change :login too, same error happens, :login is empty too. I am sure