Displaying 20 results from an estimated 27 matches for "new_user".
2008 Nov 03
1
Questions about changes to Restful Authentication.
I have a couple of projects with Restful Authentication
The first snippet is from the Git repo today and is supposed to be the
newer code.
# Store the given user id in the session.
def current_user=(new_user)
session[:user_id] = new_user ? new_user.id : nil
@current_user = new_user || false
end
# Store the given user id in the session.
def current_user=(new_user)
session[:user_id] = (new_user.nil? || new_user.is_a?(Symbol)) ?
nil : new_user.id
@current_user = new_user || :...
2006 May 07
1
Overwriting setters for associated objects
...really easy when overwriting a setter for
a table column, but in this case it is the setter for an associated
object.
Here''s a hypothetical example:
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
def user=(new_user)
self[:user] = new_user
self[:user_id] = new_user.id
# do other stuff (not relevant here)
end
end
Unfortunately `self[]` only works when modifying table column values, so
`self[:user] = new_user` doesn''t do anything. The only solution I have
at the moment is th...
2011 Sep 27
2
passwd problem with new vps
greetings,
I am setting up Centos 6 i686 remotely, on a new VPS.
A problem I have is that I cannot set password for new users. I have
created one with
useradd -m new_user
but when I type
passwd new_user
this is the result:
[root at vps ~]# passwd new_user
Changing password for user new_user
New password:
Retype new password:
passwd: Authentication token manipulation error
[root at vps ~]# tail /var/log/secure
Sep 27 17:30:30 vps passwd: pam_cracklib(passwd:c...
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
...om the session. Set it to :false if
login fails
# so that future calls do not hit the database.
def current_user
@current_user ||= (login_from_session || login_from_basic_auth
|| login_from_cookie || :false)
end
# Store the given user id in the session.
def current_user=(new_user)
session[:user_id] = (new_user.nil? || new_user.is_a?(Symbol)) ?
nil : new_user.id
@current_user = new_user || :false
end
# Check if the user is authorized
#
# Override this method in your controllers if you want to restrict
access
# to only a few actions or if you...
2007 Aug 02
1
write_attribute functionality for related objects?
Hi. Given:
class Group < AR
has_many :users
end
Is it in any way possible to retain reference to the old users when
they get replaced using group.users=(new_users) ?
The below doesn''t work but illustrates what I''m looking for:
class Group < AR
has_many :users
def users=(new_users)
@old_users = users
write_attribute(''users'', new_users)
end
end
I need to examine the differences when related objects (in t...
2006 Jul 26
2
sessions
hi!
im implementing a login system for a messageboard. tooked from a book.
pretty simple. everythings works great, but in the example the idea is,
when i want to create a new message, the author name shall be tooked
from the session[:user]
def create
params[:message][:date] = Time.now
params[:message][:author_id] = @session[:user].id #here!!
@message =
2006 May 19
1
validates_presence_of and ajax-forms
Hi.
I have "validates_presence_of :login, :password, :firstname,
:lastname" in my user-model. I enter the information in
new_user.rhtml:
<%= error_messages_for(:user) %>
<%= form_remote_tag :url => { :action => :register }, :html => { :id
=> ''new_user'' } %>
I have a register.rjs with :fade.
Omitting firstname or any other required field doesn''t trigger any
error-message. I...
2009 Jun 11
8
before_create return value breaking object.save: rails bug?
...lbacks. In one
of them, if it happens to return false (just because the last statement
in it evaluated to false), then the saving gets blocked - i can see the
db transaction rolling back. However, this doesn''t affect the results
of calling .valid? on the object, so i get this situation:
new_user.valid?
=> true
new_user.save
=> false
new_user.errors.full_messages
=> []
This has caused me a considerable amount of beard-tugging to track this
down.
Now, i was under the impression that before_create doesn''t care what''s
returned by the method it calls, and for my...
2006 Mar 30
4
Select List to change type of STI class
Hi:
I''m trying to create a drop-down list to change the type of a Single
Table Inheritance class. I tried this:
<%= select :user, :type, [ [''Author'', ''Author''],
[''Editor'', ''Editor''],
[''Administrator'', ''Administrator''] ]
2008 Jan 04
2
Nested Routes + Facebook Resources
...e nested routes working with the facebook_resources
method?
My routes.rb has:
map.facebook_resources :users do |users|
users.facebook_resources :images
users.facebook_resources :connections
end
but user_connections_url won''t generate.
"rake routes" gives me:
new_user POST /users/new
{:action=>"new", :controller=>"users"}
users POST /users/index
{:action=>"index", :controller=>"users"}
show_user POST /users/:id/show
{:action=>"...
2007 Oct 16
12
Example for attr_accessible?
Is anyone out there writing specs to check attr_accessible fields? I had
originally written my spec to check for allowing the desired fields, and
then none of the other regular db fields. Unfortunately this isn''t
satisfactory, because attr_protected could have been used instead, which
of course wouldn''t prevent mass assignment to any whatever=(val) method.
I''m thinking
2007 Oct 16
10
Scenarios Plugin Pre-Announcement
This is sort of a pre-announcement for a Rails plugin my friend Adam
Williams and I are working on. We''re in the process of extracting it
from a project we are working on so that it can be generally useful to
the Rails community. We are calling it "Scenarios". It is a drop in
replacement for Rails fixtures:
http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README
2013 Sep 20
1
Automation of puppet configuration code
Hello,
I work for the CHTC (Center for High Throughput Computing) at the
University of Wisconsin, Madison. We utilize puppet for most of our
configuration management. Currently we have a web application that
performs the tasks of user account management. When a new user is
registered with the application, the application does some very limited
parsing of a puppet manifest that has
2006 May 06
0
MyAlbum - photo application
...orums
You can find a demo at: http://www.mojialbumi.com/en/
Subversion repository is located at:
http://www.mojialbumi.com/svn/MyAlbum/trunk/
You can login as demo user: http://www.mojialbumi.com/en/doc/demo_users.txt
Or create new user, here is a small guideline:
http://www.mojialbumi.com/en/doc/new_user.txt
Glad to hear your comments,
Igor
2005 May 17
0
NT domain computer account
Hi list,
Curiosity killed the cat, but...
I've been reading samba sources and I can't quite figure out what
'features' of UNIX account is required for 'workstation account' (as in
NT domain).
The furthest I coud get to pin-point the requirements, is the pdbedit
source (source/utils/pdbedit.c), where we have two functions:
1) new_used(*context, *name, *full_name, *home,
2009 Sep 30
1
2 RESTful controllers for the same resource
Hi everyone I want to have two restful controllers for the same
resource (Users)
One controller (UsersController) is straight in the controllers folder
and is used for singup and so on
Then i need another controller for users which is inside an admin
folder (Admin::UsersController)
In my routes.rb i have
map.resources :users
# Sample resource route within a namespace:
map.namespace
2008 Jan 23
6
sharing specs in a subclass
Hi
I''ve spec''d a class and they pass.
Now I''d like to assure that any subclass of this class also passes
the same specs.
Any suggestions for a clever way to handle this?
I''d prefer to keep the existing specs as is (eg instead of moving
everything into shared behaviors, or doing something to all the
''describe'' lines)
thanks
linoj
1998 May 14
3
Cannot use smbpasswd for new user
More information on the problem.
A couple of days ago I posted a request for help for this error msg
terre{testgb}73: smbpasswd
Old SMB password:
New SMB password:
Retype new SMB password:
/opt/samba/bin/smbpasswd: machine 127.0.0.1 rejected the session setup.
Error was : ERRSRV - ERRbadpw (Bad password - name/password pair in a
Tree Connect or Session Setup are invalid.).
This happens only
2011 Jul 14
10
Devise confusing routes
...for
over an hour yesterday late at night, it seemed like I fixed it.
But now, when I want to create a New User, it''s redirecting me to the
Sign In screen. Seems like I didn''t fix the problem completely.
I think Devise is confusing the routes. If I do rake routes, I get
this...
new_user_session GET /users/sign_in(.:format)
user_session POST /users/sign_in(.:format)
destroy_user_session DELETE /users/sign_out(.:format)
new_user GET /users/new(.:format)
edit_user GET /users/:id/edit(.:format)
user GET /users/:id(.:format)
This is routes.rb
devise_for :users, :contro...
2010 Jan 26
2
accepts_nested_attributes_for :has_many :through => 'bug?'
Hey guys & ladies!
I''ve got the following relationship which i''m trying to get
accepts_nested_attributes to work with. But when i submit my form, it
looks as if its expecting a Company object, rather than an array of
companies. which really doesn''t make sense considering its a
has_many :relationship.
So what i''m after, is a way to