similar to: ActiveRecord::RecordNotSaved - bizarre behaviour.

Displaying 20 results from an estimated 1000 matches similar to: "ActiveRecord::RecordNotSaved - bizarre behaviour."

2006 Feb 15
8
Agile book - getting confusing error
Working through the beginning phase from the Agile book on ''Administration'' undefined method `hashed_password='' for #<User:0xb7911324> ... /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1498:in `method_missing'' #{RAILS_ROOT}/app/models/user.rb:12:in `before_create''
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
2006 Mar 04
4
Two quick newbie questions
2 quick questions regarding authentication ... 1) the flash[:notice] on successful login looks completely wrong to me. How should it be done? def index if request.post? @user = User.new(params[:user]) authentic_user = @user.attempt_login if authentic_user session[:user_id] = authentic_user.id flash[:notice] = ''Login successful! Welcome
2009 Sep 12
3
Cannot get my password to validate
Hello, I am working through the railsspace tutorrial, and i''ve noticed that the password validation is no longer working. I can get screen_name and email to validate, but for some reason, the password field is ignored... here''s what i have so far: within user.rb file PASSWORD_MIN_LENGTH = 4 PASSWORD_MAX_LENGTH = 40 validates_length_of :password, :within =>
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come in. Console just gives me back :account_id => nil. Obviously I''m trying to set it though. Silly console... But, I can set the account_id column in my controller like so: @user = User.new(params[:user]) @user.account_id = account.id @user.save Here''s what I give to the controller: User.create :name
2005 Dec 17
1
lost in an ActiveRecord::StatementInvalid
I have an error I don''t know how to debug. I am adding the login suport in Depot (the example in the RoR book) and LoginController#add_user throws ActiveRecord::StatementInvalid in an innocent /login/add_user GET request. The trace goes down to a call to SQLiteAdapter#table_structure, and the source code suggests what''s happening is that "PRAGMA
2013 Mar 07
1
Should ActiveRecord::RecordNotSaved attach the record in question?
I''m doing some work where I want to rescue ActiveRecord::RecordNotSaved from a save! call nested deep in the code. The thing is there could theoretically be failures here I want to pass through, and I want to inspect the record in order to decide. I figure a custom initializer on the exception class and a couple quick patches here and there in the code would make it minimally
2006 Feb 21
2
ActiveRecord before_ callbacks question
Hi! I need to set the primary key in a model and postgres table to something different than id. View Edit and such works in the scaffolded controller. However if I click in the controller below the list of data onto New then I get an error message like this: Showing app/views/admin/_form.rhtml where line #5 raised: undefined method `nr_before_type_cast'' for
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
I''ve got a really strange problem using belongs_to. I apologize in advance for the length... this is going to take a while to explain. Basic idea: Creating a User requires that the user enter an email address and activation key that matches an existing PendingUser. After creating the user successfully, that pending user should be marked as "used". The problem: When I
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 Mar 02
8
User Authentication
I''m trying to create a simple authentication system but am failing miserably. I''m (sort of) following the "Logging In" chapter of the Agile book. Ideally, any access to http://example.com/publish (and any of its subdirectories) should redirect to http:/example.com/publish/login when there is no valid session user_id. Code so far:
2006 Aug 07
2
NoMethod Error: Modifying Location of support modules
I''m trying to follow along with the Agile Development with Ruby on Rails book and have encountered a problem with code having the following syntax (partial class provided): require "digest/sha1" class User < ActiveRecord::Base private def self.hash_password(password) Digest:SHA1.hexdigest(password) end end I''m getting an error as: undefined method
2012 Jun 08
2
rubycas-server login fail
Hi all, I''ve installed Puppet Enterprise 2.5 on Ubuntu 10.04.4 ("minimal" version on our new hosting provider, previous on amazon ec2 all works fine). So couldn''t login to puppet dashboard - internal server error. I found problem in rubycas-server. It fails when try to hash password: (/opt/puppet/share/rubycas-server/lib/casserver/authenticators/sql_encrypted.rb)
2005 Jul 26
3
Generating unique random tokens for ActiveRecord objects
I have an ActiveRecord subclass that needs to generate a random (hard to guess) token for each record in its corresponding table. Currently I''m doing something like this: def before_create self[''token''] = random_value while self.class.find_by_token(self[''token'']) self[''token''] = random_value
2006 Apr 28
7
a simple problem but difficult
how can i access to a collection that was created in the same control and the data that a want to access isn?t the id the collection has : id, usuario, comandancia comandancia is the data to access the question is how to access comandancia in @acceso this code is wrong : def new @catelemento = Catelemento.new @acceso= Catacceso.find(:all, :conditions
2006 Feb 02
4
ajax insertion into a form
After an ajax insertion in the dom, it seems the browser don''t refresh its knowledge of the page. The source of the page is identical after the insertion, whereas the display is correct. The ajax insertion is used to add an input field. The added fields are ignored by the submission of the form. Isn''t it possible to do that, or maybe there''s a problem in my code
2009 Apr 21
11
can we decrypt the cipher encrypted using Digest::SHA1.hexdigest
what i have done is as follows password = Digest::SHA1.hexdigest("#{salt}:#{password}") pass1 = Digest::SHA1.hexdigest("#{salt}:asdfgh") pass2 = Digest::SHA1.hexdigest("#{salt}:asdfgh") pass3 = Digest::SHA1.hexdigest("#{salt}:qwerty") puts pass1==pass2 puts pass1==pass3 This works fine but i need to get the decrypted password how can i get it any help is
2005 Apr 23
7
Validation question
Hi all, Is there a way to invoke validations at times other than save, create and update? I know that I can do this by writing my own validation checks using errors.add_[blah], but I''d like to leverage the existing validation code. What I have is two sets of fields in a record, set A and set B. Both sets must be validated on record create. However, the trouble is that after
2006 Apr 21
1
Catch authentication result from a model in a controller
Im still following the authorization recipe from the book, now all works fine but im getting trouble in how handle the model authorization result, if the user and pass are correct, it goes to a welcome screen(admin.rhtml) but if wrong the model prints a message in an ugly exception like page "usr and pass not correct", i want to redirect the user to the login
2008 Dec 13
2
Need Help in converting php encryption decryption code to ruby on rails
Hi guys i found this encryption decryption in php and try to convert it in rails but i am unable to successfully convert it. So plz help me. I you write the whole conversion code then it will be great. PHP code is like this ================ # #/********************************************** #** #** MD5 block cypher #** #** Author..: leapinglangoor [