Displaying 20 results from an estimated 1000 matches similar to: "Getters and setters problem?"
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 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
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 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 Jun 16
2
Problem with User Login from Agile Web Development
I am trying to use an expanded version of the User Login from the Agile
Web Development with Rails book. It takes the user name and password
but then says "Invalid user/password combination". Looking at the log
everything seems to be fine until it sends the query to MySQL. The
query shows that the name is '''' instead of the name that was passed to
the self.login
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
2006 May 12
12
Anyone tried the recent Mac OS X Security update?
It includes a patch for Ruby. I have already installed 1.8.4 from
source, and updated my PATH to look in /usr/local first, so I don''t
imagine that anything Apple does to "their" copy of Ruby will have any
impact on me, but I''m wondering if the changes to their Ruby is
something that needs to be done to 1.8.4 as well.
Thoughts?
Walter
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 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 Apr 21
2
Using before_create and conflicting setter method...
Hi,
I am having trouble using before_create when I have an specialized
setter method:
before_save :set_campaign_start
#-----------------------------------------------------------------------
-------
def set_campaign_start
self.campaign_start = Time.now
end
# We want the date to always start at midnight
2005 Jul 13
0
Testing failing
So I''m trying to be a good agile programmer and write unit tests for
my objects, but I''ve got a test I just can''t keep from failing.
I have a profile object that I just added username and
hashed_password to. I used the method in the Rails book to handle
hashing the password. My code is strait out of the book. The whole
object is at the end of this email.
I want
2015 Nov 20
1
Good practice for naming classes, builders, attributes, getters/setters for object composition
Hey everyone,
I am developing a package and I am wondering if there is a good practice
for naming classes, builders, attributes getters and setters when dealing
with object composition. I know that it is usually a good practice to give
to the builder the same name as the class and, if possible, to avoid to use
upper case letters. My problem is that, when I build an object containing
an other
2004 Apr 26
7
TRW: getters and setters
Hi all,
I mentioned this on the forum but wasn''t sure if
anyone was paying attention. I was just wondering if
it would be possible to replace the
get_something/set_something style methods with the
more Rubyish something/something= style (i.e. uniform
access).
For example, the Button class currently has
button.get_label and button.set_label("foo"). It
would give me warm,
2006 Jul 17
19
updating model
hello,
i am writing a simple user login system.
when registering a user account, i have two field:
password
password_confirmation
which are validated using
validates_presence_of
validates_confirmation_of
and these are then used to generate a password hash which is stored in
my database
when i want to update the record (without changing the password and
entering new values for password and
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
2005 Aug 18
2
Asterisk configuration from database with res_config
I want to let Asterisk read its configuration from a mysql database. I
configured everything according to the wiki page:
http://www.voip-info.org/tiki-index.php?page=Asterisk+res_config.
However it doesn't work. I am using 1.0.8 asterisk version and here are
my config files:
Extconfig.conf:
[settings]
;uncomment to load queues.conf via the db engine.
;queues.conf =>
2006 Jul 16
0
Problems with validates_lenght_of
I''m building a login system, and I want users to be able to update their
password, first name and last name after signing up. So, when signing up
password can''t be nil, and it must be between 6..20 characters long. However,
on update, the user can choose to leave the password field empty (but fill in
other stuff, like first name) and then I want the User model to not update
2018 Oct 09
3
Test report xen_4.11.1~pre.20180911.5acdd26fdc+dfsg-2
I'm just dumping all I got in here, after initial feedback we can see
how to organize todo's around it.
tl;dr:
* Does not upgrade cleanly from 4.8 packages, so we have to prevent this
from entering testing until we fix that.
* Live migration is broken, explodes with memory allocation errors.
---- >8 ----
1. Build packages
* I have built salsa/master using pbuilder targeting sid.
2006 May 02
9
Updating only one field
At present, I use an update like this to set the user''s last login time:
authenticated_user.update_attribute(:last_login, Time.now)
However, this calls the following, updating all fields:
UPDATE users SET `last_login` = ''2006-05-02 13:27:41'', `hashed_password`
= ....
Is there any way I can tell ActionRecord to only update the one field?
I don''t really want