Displaying 20 results from an estimated 600 matches similar to: "User.already_friend_of(friend)?"
2006 Jan 28
1
Advice on Optimization, and where to put what?
In my last post I was asking how I could check for the existance of a
record before inserting a new one and this was the helper method that I
was using to do this:
def already_friend_of?(friend)
begin
self.friends.find(friend.id)
true
rescue
false
end
end
I was told that this is not very efficient, as it hits the db every time
I call it. I completely agree and would like to
2009 Aug 15
4
Isn't there any performance issue when saving serialized attributes every time?
In edge rails, serialized attributes are saved every time no matter
they are changed or not:
def update_with_dirty
if partial_updates?
# Serialized attributes should always be written in case
they''ve been
# changed in place.
update_without_dirty(changed | (attributes.keys &
self.class.serialized_attributes.keys))
else
2009 Feb 02
2
ActiveRecord::AssociationTypeMismatch (User(#54754560) expected, got User(#54510280))
i keep getting this AssociationTypeMismatch error. i think this could
be a bug related to ruby/rails when using mixins. heres a short
version of my code:
# user.rb
require ''friend_invitation''
require ''friendship''
class User < ActiveRecord::Base
include FriendInvitationUser, FriendshipUser
...
end
# friendship.rb
...
module FriendshipUser
def
2006 Feb 28
2
SwitchTower rake deply failure on DreamHost
I''ve been following some tutorials on how to get switchtower working on
dreamhost. I got the setup to work just fine, but the rake deploy
doesn''t work. I get the following error. any ideas?
----------------------------------------------
> rake deploy
(in /home/.interim/i8ramin/work/yaram.com)
loading configuration
2008 Apr 07
2
Simple active record issue. I must be missing something.
Here''s a seemingly simple ActiveRecord use case. I have Projects and
Users. Each project has a single team leader as well as a review team
that consists of several users. I would like to use the same User
model for authentication and just reference these users in my Project
model.
I tried this but got an "unknown column" error (for User.project_id)
class Project
has_one
2005 Dec 21
2
Missing error page templates
Whenever I get any errors on my application, I don''t get the regular
rails error page with all the debugging information. What could''ve
cause this? This is from the logs:
ActionView::ActionViewError (No rhtml, rxml, rjs or delegate template
found for /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/templates/rescues/template_error.rhtml):
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a
hard time designing my db. This is what i have in mind, but I am not
sure if its the best approach.
user has_one inbox
user has_one outbox
inbox has_many messages
outbox has_many messages
inbox table
user_id
outbox table
user_id
messages table
box_id (refers to either inbox or outbox - how?)
from_id
to_id
2006 Mar 17
1
Design / Pattern / Scaffold for has-and-belongs-to-many ?
Is there a standard practice for providing a UI into HBTM relationships?
I have a model User, and a model Training, and I need to manage both
relationships -- show me all the people that have training X, but also
show me all trainings user U has. And, of course, "Lookup this user and
then add/remove trainings for this person" or "Lookup this training and
add/remove
2007 Jul 22
4
single table inheritance problem
Hallo,
I am having a very strange Problem with STI in my application.
setup:
- two tables one called "wikis" on called "categories" with a hbtm
relationship.
- the wikis table is the sti one with a model PageWiki being extended
from Wiki (and the correspondig type column)
Following happens:
- server restart
- get :wikis, :show_pages
- in show_pages the first line says
2005 Nov 18
10
[Request] file_column configurability
I wasn''t sure where to email this request, so I am hoping the author of
file_column actually sees this. I was wondering if there were any plans to
allow some configurability in the file_column plugin. By configurability I
mean allowing the developer to define which table column is used as the
unique identifier when creating image folders. Right now it seems like it
uses the ID of the
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to
2006 Jan 06
2
Re: Some advice on DB modeling
I have more or less the same problem. I''m trying to build a system where
users can enter their friends. But the solutions seems not to work for me.
I used same sql:
CREATE TABLE `friends` (
`user_id` int(11) NOT NULL default ''0'',
`friend_id` int(11) NOT NULL default ''0'',
KEY `user_id` (`user_id`),
KEY `friend_id` (`friend_id`),
2006 May 28
3
Association of table to itself
I''m curious what would be the best way to represent people and whether the
person has someone marked as their friend. Here are my thoughts so far:
People table
- id
- name
Relationships table
- person_id
- friend_id
Now my problem is I don''t know how to set up these associations (if this is
even correct). Friend_id would be an id to someone else from the people
table.
2005 Apr 01
11
I want to blog!
This isn''t Rails or Ruby related, but I just need some advice and
thought I''d ask the bright individuals here. I want to start my own
blog but I''m not sure where to begin. I don''t want to get a blogger
account because I want to have my own domain. Blogger also doesn''t
have many features. My hosting service is 1AND1 so it supports php,
cgi and mysql.
2008 Aug 29
3
Many to Many Relationship with One Model
Hey everyone,
I''m working on allow users to follow other users in my app so they can
receive updates to what all their friends are doing (like Facebook/
Twitter). I''m wondering on how the relationship would be for the
model. Sounds like a HABTM type of association, but how would I go
about doing it for only one model?
Thanks,
Tony
2006 Oct 31
5
conditional boost? friends to come up at top of search...
Hey guys, im trying to get my friends to come up at the top of the act
as ferret search. I would query the whole result set first, then move my
friends to the top, but the thing is, Im paginating my results and use
the offset and limit parameters in the multi_search() function.
Anyone know how to do this?
Thanks in advance...
--
Posted via http://www.ruby-forum.com/.
2006 Mar 31
6
Adding objects to a :through association
So I''m one of those nasty people building a self-referential
habtm-like Association using the funky new :through stuff. This is
about users having friends, so here''s my user.rb:
class User < ActiveRecord::Base
has_many :friendships, :foreign_key => ''user_id''
has_many :friends, :through => :friendships, :source => :friend
end
And here''s
2010 Sep 17
1
friend of a friend type darknets
Hi!
here a little patch for darknet functionality, i hope it does what its
intended for sufficiently ... but it seems to work :).
what should it do?
imagine your friend-network. A trusts B and C. B trusts D and E, D trust
F, C trusts G. All trust relationships are mutal
A <---> C <---> G
^
\
\-----> B <---> D <---> F
^
\
\---> E
2005 May 08
3
[OT] Linux Development Environment - suggestions
Hey, sorry for the off topic email, but I appreciate any feedback you guys
can give me.
I just put together a new box and installed Ubuntu linux on it. I''m coming
from a totally windows environment, so I''m having some trouble getting my
head around the linux file system and where things "should" go.
I am trying to create a nice development environment for myself
2006 Nov 04
1
Angel friend postcard has arrived for you!!
<div>
<strong>Hello friend !</strong><br>
A friend has sent you an ecard from www.bluemountain.com<br><br>
Send free ecards from www.bluemountain.com with your choice of colors, words and music.<br><br>
Your ecard will be available with us for the next 30 days. If you wish
to keep the ecard longer, you may save it on your computer or take a