Displaying 14 results from an estimated 14 matches for "entity_ids".
Did you mean:
entity_id
2006 Jan 18
6
Using conditions in ActiveRecord
This bit of code finds several groups; all those which have
entity_id''s of ''1'' OR ''2'' OR ''3'', as you would expect:
ee = [ 1, 2, 3 ]
groups = Group.find(:all, :conditions => "entity_id in (" + ee.join
(",") + ")")
But this bit of code only finds groups which have entity_id''s of
2006 Jan 31
4
has_one without inverse belongs_to
I have two models called entity and user.
The entities table has a column called users_id that contains the user
id of the user that created the entity.
In entity I have...
has_one :user
... as I want to be able to show the user who created the entity from
the entity object.
But this produces the following error...
Mysql::Error: #42S22Unknown column ''users.entity_id'' in
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
2007 Feb 12
2
Objects in Arrays? Allowed, right?
Hi:
I''m trying to manually append objects to an instance variable that is
just an array of objects. Here''s my controller code:
@tasks = Task.find(:all, :conditions => "entity_id =
#{session[:user].id}")
for t in @tasks
if Subtasks.find(:first, :conditions => "child_id = #{t.id}") != nil
@mtasks << t
end
end
However, when I execute, I
2009 Feb 15
3
conditions on association include, hacky but more or less solved
Hi all,
I just finally figured out how to get 2.2.2 to do this, and thought
I''d share in case others run into the same thing.
The situation is a find with associations, but the tricky part is that
the association shouldn''t always be loaded. This is similar to putting
a condition on a has_many association in a model, but the condition is
dynamic rather than predefined.
The
2006 Jul 20
2
a rails model question
Hi all,
I am a newbie in ruby/rails.
I have a question about my database model:
table1: entities (name, description, author_id ...)
table2: relations (source_id, target_id, relation_type) (it describes
the relations between 2 entities and the relation type)
How can I define models using rails, or do I need to redefine my
database schema?
thank you
--
Posted via http://www.ruby-forum.com/.
2006 Mar 04
2
Using Migrations to Build a MySQL FULLTEXT index?
Can anyone point me to the proper syntax to build a FULLTEXT MySQL
index via migrations?
I''m really liking these things, and don''t want to step back into the
world of manual intervention.
2009 Dec 15
0
Problems reloading plugin extending AR model
Hi,
I have an AR model called Entity, which is extended in a plugin like
this (this is in a file under lib/ which is required by init.rb of the
plugin):
http://github.com/dedomenon/madb_notifications/blob/master/lib/madb_notifications_lib.rb#L8
Entity.class_eval do
def user_subscribed_to_creation?(user_id)
NotificationSubscription.find(:first, :conditions => [
"source_filter
2006 Aug 03
0
How to create/save unary (pk-only) models
I have a table that''s currently only a primary key. Basically:
create_table "entites", :force => true do |t|
end
class Entity < ActiveRecord::Base
has_many :entity_members
end
create_table "entity_membership", :force => true do |t|
t.column "person_id", :integer, :null => false
t.column "role", :string, :null
2008 Apr 08
1
Help with primary_key_prefix_type
I put this config in environment.rb
# Use table_id instead of id for primary key.
config.active_record.primary_key_prefix_type =
:table_name_with_underscore
I have this migration:
class CreateEntities < ActiveRecord::Migration
def self.up
create_table :entities do |t|
t.string :entity_name, :null => false,
:limit => 40
t.string
2006 Jun 11
4
[Question} how best to use attribute driven db with Rails
I designed out a mostly attribute driven database. Originally i was
going to use PHP, but have now decided to use RoR. Being able to use the
built in OR functionality would be nice, but I am not sure how well it
melds with attribute dbs.
If anyone can give me some pointers, I would really appreciate it
(especially since this is my first endeavor and on an important project
as well).
2008 Mar 08
9
Validation error handling on related models
I have 2 models, entity and client. Entity has_one client and client
belongs_to entity.
Entity has attributes name and legal_name. Entity also has an unique
index on (lower(name)). The pKey for both is the conventional Rails id.
Client has a fKey constraint on entity_id and is indexed in entity_id.
In controllers/clients_controller.rb I have:
# GET /clients/new
# GET /clients/new.xml
2006 Jul 04
8
inherits_from: Multiple table inheritance
Hey guys,
I just implemented very simple and primitive class table inheritance in
ActiveRecord. The goal is for this to become mature enough to become a
true feature in Rails. Check it out here:
http://guest@blog.raylucke.com/svn/inherits_from
Here?s how it looks in action:
create_table "books", :force => true do |t|
t.column "product_id", :integer
t.column
2006 Apr 22
9
one to many question
1. A category has parent categories.
2. A product is in many categories and a category has many products.
3. Products and category both have images in the same image table. ie. a
product and / or category could have multiple images.<=== my question is
related to this
So among other things I presume I have to do the following:
class Category < ActiveRecord:Base
#...