Displaying 20 results from an estimated 194 matches for "topic_id".
2006 May 28
3
Working with topics and categories
Hello guys,
I''m a newbie in RoR and I have a problem. My DB structure is
======================================
topics table : id(int,11)
name(varchar,255)
categories : id (int,11)
topic_id(varchar,255)
name(varchar,255)
======================================
--Models:--
class Topic < ActiveRecord::Base
has_many :categories
end
class Category < ActiveRecord::Base
belongs_to :topic
end
I need page structure like this:
<h3>Topic1</h3> (id = 1)
<...
2005 Jan 21
2
collection_select
I''m trying to use collection_select, but it''s not working as I expect. The
list populates correctly but the current value is not selected.
@question contains a topic (via topic_id), and @topics is the list of all
topics. Here''s my attempt to create a drop-down list of the topics.
form("question") do | form |
form << content_tag("b", "Topic")
form << collection_select("topic", "topic_id", @t...
2005 Dec 17
3
Can scaffold generate listboxes in views? I''ve been unsuccessful.
...reatedb test. Now I go into Postgresql by
typing ''psql test''.
Here are my tables:
CREATE TABLE topics (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL
);
CREATE TABLE blogs (
id SERIAL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
topic_id INTEGER NOT NULL REFERENCES topics(id),
content TEXT NOT NULL
);
Next, back in the test folder, I type ''script/generate scaffold Topic
Topic''. This creates my topic pages. So far, so good. Next, I type
''script/generate scaffold Blog Blog''. This cr...
2007 Jan 31
2
has_many :conditions
...put conditions relative to the current instance in
has_many''s :conditions?
For example, in a forum app:
class Post < ActiveRecord::Base
belongs_to :topic
has_many :self_and_descendants, :class_name => "Post", :order =>
"lft",
:conditions => "topic_id = #{topic_id} AND (lft BETWEEN #{lft} AND
#{rgt})"
end
With the above code, I get the following exception:
undefined local variable or method `topic_id'' for Post:Class
I''m not interested in whether acts_as_nested_set is a good idea or
already has this functionality. It&...
2009 May 11
7
Contribute request
Hello!
I was advised by the forum moderator to ask for contribution:
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=20223&forum=38&post_id=76546#forumpost76546
My wiki login is VladislavRastrusny
I would like to contribute for Tips & Tricks section with a small
automated script to install webmin repository data and webmin itself
from here: http://www.centos.org/modules/newbb/viewtopic.php?topic_id...
2006 Nov 28
17
Index not being updated
My index is not being updated when I add new records or amend existing
ones.
Can anyone point me in the direction of where I should be looking for
what is going wrong?
I''m running this in the production environment.
--
Posted via http://www.ruby-forum.com/.
2006 May 07
1
Find records not in join with has_many_and_belongs_to
...So my User model object
is using has_many_and_belongs_to :topics and vice versa. I want to find all
the topics that a user has *not* subscribed to. This is what I''ve got:
@user = User.find(params[:id])
@topics = Topic.find(:all,
:conditions => ["id not in (select topic_id from topics_users where
user_id = ?)", @user.id])
I''ve been told that this kind of NOT IN (SUBQUERY) is an inefficient way of
getting the data, and that using a outer join with an "is null" criteria is
the way to go. So now I''ve got this:
@user = User.find(pa...
2006 May 30
2
acts_as_tree, acts_as_list and is invincible (help!)
So I have the following model
class Topic < ActiveRecord::Base
belongs_to :topic
has_many :topics, :order => :position
acts_as_tree :order => :position
acts_as_list :scope => :topic_id
end
that I use for a site''s navigation. Everything (list, create, edit, even
the drag&drop sort) works fine, except the destroy function, which the
vanilla version
def destroy
Topic.find(params[:id]).destroy
redirect_to :action => ''list''
end
which gives me...
2006 Aug 25
3
RJS Error: Element.update is not a function
Hi,
I have implemented some RJS code and I have the same exact code in 2
different places. In one place I get the error "Element.update is not
a function" and the other place works fine. Any idea why this error is
coming? Breaking my head.
-Vinod
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2011 Aug 11
17
f.collection_select: what are the parameters?
The rails docs are so horrible on the collection_select method. They
need to show a *complete* form, and show two examples: one that calls
f.collection_select(), and another that calls collection_select(), and
explain the differences.
Given this line:
f.collection_select :topic, Topic.all, :id, :category
What the !@#$!@#$ is :topic?
--
Posted via http://www.ruby-forum.com/.
--
You received
2009 May 08
3
Potential loss of a wiki contributor.
Ralph,
Will you please check posts #17, 18 & 19 of this forum thread --
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=19968&start=0#forumpost76277
When you have a moment, I'm sure you will reply to it. :-)
Alan.
2005 Aug 08
3
Caching nameserver
I am having some issue with setting up a caching nameserver.
here's the link:
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=150&forum=10&post_id=400#forumpost400
the OS is now CentOS4
--
My "Foundation" verse:
Isa 54:17 No weapon that is formed against thee shall prosper; and
every tongue that shall rise against thee in judgment thou shalt
condemn. This is the heritage of the servants of the LORD,...
2008 Aug 13
2
Help setting up external drive via Firewire
...1+ hour to fully backup just one day's worth of data or about 100GB.
So I was hoping Firewire would be faster, which is why we got the version
with all 3 interfaces to experiment with first.
Following the suggestions given to another user here
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=15767&forum=37
I updated the system's kernel to the CentoPlus
[noob at localhost ~]$ uname -s -r
Linux 2.6.18-92.1.10.el5
After a reboot, everything appears to work as expected, with the
motherboard's TI Firewire controller detected
[root at localhost ~]# lspci | grep 1394
04:07.0 Fir...
2009 Mar 08
2
RESTful nested resources and polymorphism?
...vious post: http://www.ruby-forum.com/topic/180356
I am now able to access items from topics controller. However, now I
need to add sub-item e.g.: An item itself could have many sub-items. So
my items model is like:
class Item < ActiveRecord::Base
validates_uniqueness_of :title, :scope => [:topic_id]
validates_presence_of :topic_id, :title, :owner, :position
belongs_to :topic
belongs_to :parent,
:class_name => "Item",
:foreign_key => "parent_id"
has_many :children,
:class_name => "Item",
:foreign_key => "parent_id",...
2006 Feb 18
14
Composite primary key support in ActiveRecord?
...o think that using
multiple integer column id''s (composite primary key) are often
natural way to implement one-to-many relationships, for things like
"forum replies". For example, ID for the third comment of forum
topic #87 should be (87, 3) not (87, 1074), format being (topic_id,
reply_id).
Currently, I''m trying to work around this by using ''TopicReply.find
(:fist, conditions => ["topic_id=? AND id=?", 87, 3]'' instead of
''TopicReply.find(1074)''. However, I haven''t figured out yet how to
save such o...
2006 Jan 22
11
ActiveRecord find
Suppose I have three tables - authors, posts and topics.
Every post have a topic and every topic has an author, so I have
posts.topic_id and topic.author_id. When the author is guest (not
registered), author_id is nil.
I need to find all the posts (in one query) where every post have all
the information of the topic and the auther, so if p is one of those
posts I could get the name of the author like this:
name = p.topic.author....
2009 May 14
2
Possible SAN Issue
Just a quick ping to the general m/l.
Is there a SAN expert out there who could spare some time to have a
look at this forum post, please?
URL -- http://www.centos.org/modules/newbb/viewtopic.php?topic_id=20273&forum=39
Alan.
2011 Apr 17
2
Heads up: Bugged update xorg-x11-server-utils-7.1-5.el5_6.1 upcoming
Hi,
Reading
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=30939&forum=37 I noticed a warning about an upcoming bugged update xorg-x11-server-utils-7.1-5.el5_6.1
I would advise everyone to add
exclude=xorg-x11-server-utils-7.1-5.el5_6.1
to their updates repo config.
Regards,
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
2006 Nov 22
0
Returning objects (not ids) in grouped count
...ouping
returned be an object, not an object id.
Consider a blogging application. I want to return a list of topics with
their posting counts, filtered by a user id.
This:
Topic.count :conditions => ["user_id = ?", 1], :joins => "INNER JOIN
postings ON topics.id = postings.topic_id", :group => "topics.id",
:order => "count_all DESC"
Returns an array of arrays, each array containing a topic id and count,
like:
[[302, 12], [110, 7]]
That''s because the SQL generated by my command above looks like:
SELECT count(*) AS count_all, topics...
2009 Oct 15
2
Model.Save causing nil object error
...end
class RelationshipTopic < ActiveRecord::Base
validates_uniqueness_of :topic, :scope => :relationship
belongs_to :relationship
belongs_to :topic
end
Now, here is example code of me trying to create a new
RelationshipTopic:
@rel = RelationshipTopic.new(:relationship_id => 1, :topic_id => 1)
=> #<RelationshipTopic id: nil, relationship_id: 1, topic_id: 1,
primary: nil, created_at: nil, updated_at: nil>
>> @rel.save
@rel.save
NoMethodError: You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.text?
Why am I unable to...