This also happens when two users have the following usernames:
  user-name
  user_name
What happens is that they would have the same login_slug and whoever
registers first is the one returned by the find method.

Just override the generate_login_slug method to fix this bug.

def generate_login_slug
    self.login_slug = self.login.gsub(/[^a-z0-9_]+/i, '-')
end


On Oct 2, 3:40 am, Bruno Bornsztein <[email protected]>
wrote:
> Hi Chris,It may be a bug. To submit your changes (please make sure to write
> passing tests that cover this scenario), just send me a pull request on
> GitHub or send a patch.
>
> Here's some more info:http://help.github.com/forking/
>
> Thanks!
> Bruno
>
> On Wed, Sep 30, 2009 at 7:38 PM, Christopher Becker 
> <[email protected]>wrote:
>
>
>
>
>
> > I have a user whose login ends with '5000'.  The url builder deals with
> > this by making it '...5-' in the urls, fine.  But when I did invite a friend
> > on this user, it actually created a friendship a completely different
> > user...WHAT?!   So I took a look at the controller/view and came up with
> > these changes
> > for FrienshipsController.add_friend:was:         @friendship =
> > Friendship.new(:user_id => @user.id, :friend_id =>
> > User.find_by_login(params[:friend_id]).id, :initiator => true )
> > *became: @friendship = Friendship.new(:user_id => @user.id, :friend_id =>
> > params[:friend_id], :initiator => true )*
> > *
> > *
> > Also changed my friendship link in the view:
> > *was:   user_add_friend_url(current_user, user)*
> > *became: user_add_friend_url(:user_id=>current_user.id, :friend_id=>
> > user.id)*
> > *
> > *
> > This is a bug right?  I'm not sure what the process is for working on the
> > current dev branch but if someone can point me to a "getting started" or
> > wiki or whatever I can look into adding this myself.
>
> > Cheers,
> > Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to