Displaying 20 results from an estimated 1100 matches similar to: "Member.buddies.sort >> undefined method `<=>''"
2006 Jan 09
6
has_and_belongs_to_many :self
Hi all
I got the following class:
class Member < ActiveRecord::Base
has_and_belongs_to_many :buddies,
:class_name => ''Member'',
:join_table => ''members_have_buddies'',
:foreign_key => ''member_id'',
:association_foreign_key =>
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that
my users can have multiple roles.
("Admin" role does always have id = 1).
I have added these methods to my application controller.
<code>
helper_method :is_admin?
helper_method :is_user?
def is_admin?
if @session[''user'']
@session[''user''].roles.find(1)
2005 Mar 04
4
Upgrading broke the .find methods???
I just updated to rails (via gem) and now all my .find..... methods
give me "wrong number of arguments(3 for 0)" with the exception of
find_by_sql which works fine but I want to avoid for obvious reasons.
I''ve tried simplifying everything down to the bare minimum
Priorities.find(1)
and I printed out Priority.table_name to confirm it was still correct.
What gives? Did I
2006 Jan 12
0
HABTM with conditional field in relation table
Hi all
I have members in my application, and every member can assign other
members as buddies.
class Member < ActiveRecord::Base
# Hat folgende Buddies
has_and_belongs_to_many :buddies,
:class_name => ''Member'',
:join_table => ''members_have_buddies'',
2006 Feb 27
4
2 belongs_to to the same parent table
Hello!
I have 2 table: users and buddies
User: id, name, ...
Buddy: id, user_id, user_buddy_id, ...
So if you have 2 users 1,jack and 2,fred and fred is a buddy of jack,
there is a Buddy object: id=1, user_id=1, user_buddy_id=2
I can declare only one belongs_to in Buddy and one has_many in User. And
there is conflict if I had the second one (the first one is discarded)
class User
has_many
2006 Aug 02
2
Self-Referential has_many :through
Hello all.
I am trying to create a self-referential has_many :through. I used the
following site as a guide
http://blog.hasmanythrough.com/articles/2006/04/21/self-referential-through
but it still doesn''t appear to be working. I have two models. Person and
Relationship. A person has many contacts (Which is another person)
through relationships
class Person < ActiveRecord::Base
2006 May 12
2
Agile WebDev 2nd Edition: PDF free for 1st edition owners?
Hi all
I''m just wondering if I get the 2nd version of "Agile Web Development
with Ruby on Rails" for free if I already own the 1st edition
paperback/PDF combo?
And anyway: I wanted to update my first edition, but I can''t find the
link anymore where I could get a new PDF version?
Thanks a lot for help.
Josh
--
Posted via http://www.ruby-forum.com/.
2005 Mar 10
10
Some Basic Questions
Sorry I can''t access IRC from work so I hope you don''t mind me asking my newbie
questions here:
1) I have the following code:
@post = Post.find(@params[''id''])
@comments = Comment.find_all "post_id = #@params[''id'']", "created_on ASC"
And I am have problems with the second line. I want to pass the id from my post
to the
2006 Jan 29
9
Specify options with habtm
Hi all
I have the following models:
class member
has_and_belongs_to_many :disc_jockeys
end
class disc_jockey
has_and_belongs_to_many :members
end
The relation table is called disc_jockeys_members and has the following
fields:
disc_jockeys_members(disc_jockey_id, member_id, status)
So far, the field status can have values like valid, invalid, locked
etc., but it is not regarded yet by
2007 Sep 06
4
HABTM association with own class?
If I have a class, Asset, which has and belongs to many associated Asset
objects, how do I do this?
has_and_belongs_to_many :associated_assets, :class => "Asset",
:foreign_key => ?????, :association_foreign_key => ?????
Right now, my table has a :first_asset_id and a :second_asset_id, but I
don''t see how the objects themselves are supposed to distinguish one
from the
2006 Jul 24
1
Relationship Conventions
Hi Team!
Just having a bit of trouble with the many-to-many relationship of the
same type.
Im trying to build a buddy list. So I have a users table and want to
allow each user to have a buddlist of users.
Ive tried having a User model and a Buddy model where the buddy model
has 2 fields user_id and a buddy_id but i cant get the buddy.name
methods to resolve when getting a list of buddies.
2006 Feb 21
3
HABTM :insert_sql help
Hi all,
I''m working with a legacy sqlserver db and I''m trying to override the
insert sql in as defined in the HABTM method below(becasue the join
has three primary keys), but I''m getting the error: ''undefined local
variable or method `record'' for Project:Class''
has_and_belongs_to_many :people,
:class => ''Person'',
2007 Jul 26
1
Bi-directional self-referential HABTM
Hi,
I''m having a little trouble figuring out how to make a self-
referential HABTM bi-directional.
I have a Employee class. Each employee can have a couple of bosses,
who are also employees. The employee class has the following HABTM:
has_and_belongs_to_many :bosses, :class_name =>
"Employee", :join_table => "bosses_courses", :association_foreign_key
=>
2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table
has another "non-joiny" attribute.
I went from this:
has_many_and_belongs_to :jobs, :join_table => ''tablename'',
:foreign_key => ''x'',
:association_foreign_key => ''y''
to this:
has_many :jobs, :through =>
2005 Mar 02
4
All I want for Christmas
is to run my Rails app on lighttpd ....
Unfortunately, I am tied to SQL Server, and the database connector
requires ADO.rb which only runs on Win32.
And lighttpd doesnt run on Win32.
*sigh*
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
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
2005 Jul 04
1
Localization problems with leeding html escaped ÅÄÖ
Hi All.
When translating a string to in swedish, using HTML codes for å,ä,ö i
have a minor problem.
Eg: (se.yaml)
ui_core_over: Över
All I get when calling l(''ui_core_over'') in my view is "Ouml;ver"
The leeding & is missing, making the page look silly.
The HTML characters works fine as long as it''s not used as the first
letter in the string.
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
2007 Jan 03
3
Self-referential habtm with condition is broken
Here''s a simplistic model class.
class Person < ActiveRecord::Base
has_and_belongs_to_many :relatives,
:class_name => ''Person'', :join_table => ''relatives'',
:foreign_key => ''from_id'', :association_foreign_key => ''to_id''
has_and_belongs_to_many :brothers,
:class_name =>
2009 Mar 23
2
Select updates database?
I am running on Rails 2.2.2 on Solaris (and also on my mac) against
mysql. For some reason, when I use a select in the partial, the
database does not get updated with the changed value. I am using
checkbox for other fields which works perfectly.
I can provide more information if needed, but I would like the field
to work as a dropdown instead of a text field.
My Model: