Displaying 20 results from an estimated 600 matches similar to: "Problem implementing tagging"
2006 May 19
0
Works in model but not in mixin
Disclaimer: RoR newbie. Using the acts_as_taggable plugin.
As an exercise I wanted to switch from the destructive TAG_WITH method
to adding tags while preserving the existing ones. On the surface this
seemed easy enough and eventually I got it working. However, the
following method:
def add_tags(list)
Tag.transaction do
Tag.parse(list).each do |name|
if
2006 Jun 25
1
Having Trouble Using ActsAsTaggable
I''ve installed the acts_as_taggable plugin and modifed it according to
the tutorial form making it user specific
(http://www.slashdotdash.net/blog/articles/2006/04/29/acts_as_taggable-per-user-tagging
).
I keep getting errors when I try to tag things, however, and have traced
the problem to the line of the tag_with function that calls the
find_or_create_by_name function. So I fired
2006 Apr 30
0
populating model attribute from one of many lists
I have a model named Project which contains a name attribute, and I
have a second model named Booking which has, among other things, a
date and a Project. (has_many :bookings, belongs_to :project).
When a user creates a new Booking, they have the option of using an
existing Project or creating a new Project. As an added complexity,
when choosing from existing Projects, they can either choose from
2005 Dec 02
1
Bug with Postgres and/or HABTM?
Hello list,
I think I''ve found a bug in the way Rails is talking to my Postgres DB
when recording HABTM data.
My join_table looks like this:
id serial primary key,
tablea_id integer references tablea(id),
tableb_id integer references tableb(id),
other_attributes...
When Rails writes to join_table, I''d expect it to do something like:
INSERT INTO join_table (tablea_id,
2006 Jan 04
0
Re: DB Modelling the Rails way - solution by Chris Hall
Hi Chris,
Yesterday you kindly submitted an answer to my question on modelling
many to many relationships. I''ve briefly tried the proposed solution but
so far with no luck. Before I get too involved - I''d like to know if
mapping three way :join_tables is "legal" in a Rails sense. I only ask
since you put (untested) in your mail and I can''t find any docs on
2006 Jun 07
0
Refreshing remote :through associations with deletes
Hi everyone,
I''m refreshing the local Rails database from a remote database every
10 minutes. I''m using a :through association to relate people to
mailinglists through subscriptions.
# Works fine, every 10 minutes:
remote_lists.each { |list| List.find_or_create_by_name(list.name) }
remote_subscribers.each do |subscriber|
person = Person.find_by_email(subscriber.user)
2006 May 16
4
Problems with multiple ''id'' columns in a join_table
I have a problem declaring a relationship through a join_table ; the SQL
generated by ActiveRecord is correct, but there are two columns called
''id'', and the final object gets the ''wrong'' column ...
Here''s a more detailed description of the data, code, and problem :-
There''s a People table, with id, name, and a few things.
Also a
2006 Apr 20
2
acts_as_taggable magic.... please explain
Hi,
There is a line in acts_as_taggable plugin:
send(acts_as_taggable_options[:from]).tags.find_or_create_by_name(name).on(self)
could someone explain what is:
send(xxx)
and
.on(self)
I cannot find it rDoc
--
Posted via http://www.ruby-forum.com/.
2006 Jan 07
4
To Chris Hall - Re: DB Modelling the Rails way - Opinions??
Chris,
Finally got time to fully play with your suggestions. Had to re-code a
bit of stuff but the concept works - just like a bought one :~). Many
thanks for the solution,
Kind Regards,
Eric.
For those curious - here''s what it was about;
On Monday 02 January 2006 02:10, Eric Sloane tried to type something like:
> Hi,
> I''m trying to figure the most efficient way to
2006 Jan 19
0
Help with nested HABTM relationship
Hi,
I am trying to perform a query with ActiveRecord that I want to put into
a Rails application later. For now I just wrote it within a plain old
Ruby script for easier testing.
I am working with an existing database so I had to map some foreign keys
myself. As you can see from the models below, the database has a
structure of
Prospectlists <=habtm=> Contacts <=habtm=> Accounts
2006 Jan 19
5
Multiple HABTM relationships with self ???
I need to have a table related to itself via a join table. Will HABTM
support this? That is:
class Recipe < ActiveRecord::Base
has_and_belongs_to_many :recipes, :join_table => "recipes_recipes"
end
More importantly -- how does RoR support MULTIPLE self-joins? I.e., to
relate the table to itself via multiple join tables.
SFAIK, HABTM won''t support multiple
2006 May 11
1
ActiveRecord collection_select and has_and_belongs_to_many
Hello everyone, first post to the list and a relative newbie to Rails
development. Done quite a bit of JSP, PHP, HTML, XML etc and thought I would
kick the tires on Rails to see if it can speed up development for internal
applications. Anyway, I am running into a problem that is just driving me
crazy and everything I read on the net doesn''t seem to help. I was hoping
someone here might
2006 Apr 27
0
last stupid question today
(well, from me anyway. I promise)
Trying to follow the "Self-referential Many-to-Many Relationships" recipe
from the Rails Recipes book.
This is what I''m doing: Tasks can have a predecessor relationship with each
other. My Task class has this:
has_and_belongs_to_many :predecessors,
:class_name => "Task",
:join_table => "predecessor",
2006 Jan 06
0
bug rails activerecord association join
hi,
I found a bug in ActiveRecord association SQL INNER JOIN codes. in
has_many, has_one, habtm and belongs_to queries the foreign key is
determined from the table name of reflection and self. but that''s
worng because if you use a global prefix or suffix for your tables the
foreign keys will be in format of PREFIX_CLASSNAME_SUFFIX_id which is
wrong, because it breaks the advantage of
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 =>
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a
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 Apr 17
3
model.models.models or model.models.find(:first).models
I the following three models which all have has_and_belongs_to_many
# User <-> UserGroup <-> Permissions
class UserGroup < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => "user_usergroup_join"
has_and_belongs_to_many :permissions, :join_table =>
"usergroup_permission_join", :uniq => true
end
I can do this:
permissions =
2006 May 30
3
extra attributes in habtm
Hi,
Posting here since issue tracking isn''t the best place to discuss.
I can understand habtm is moving towards deprecating support for extra
attributes in join_table, and to use :through for those cases instead.
To clarify, patch<http://dev.rubyonrails.org/attachment/ticket/5216/habtm_join_table_test.patch1.diff>for
#5216 <http://dev.rubyonrails.org/ticket/5216>
2006 Feb 15
4
problem with saving id''s in a join table
hello,
I''am new to ROR and I have a problem.
I have to models "rights" and "roles" on a has_and_belongs_to_many
relationship, through "roles_rights" table. When I try to add a new role
although I put in my form fields for each right, a record is added to
table roles but none to roles_rights.
I am using Ruby 1.8.4 rails 1.0 mysql 5.0
here is my code: