similar to: Simple active record issue. I must be missing something.

Displaying 20 results from an estimated 8000 matches similar to: "Simple active record issue. I must be missing something."

2006 Feb 09
1
Re: Help on Vicidial
Here is another log from the * server CLI, I reall hope some one can help me out on this one. thanks |SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='127.0.0.1' and campaign_id = '' and call_time < "" and lead_id != '';| -- VDAD get agent: |0|update of vla table: |127.0.0.1 |UPDATE vicidial_live_agents set
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
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 Aug 15
2
How to access attribute in a self-referential many-to-many relationship
Hello List, I created a self-referential many-to-many relationship (as described in the book Rails recipe #18), where I have a model that has many-to-many relationships with itself. In this case, it''s person who can become friends. The join table looks like this: mysql> select * from friends_people; +-----------+-----------+-----------+ | person_id | friend_id | confirmed |
2010 May 25
2
Site Navigation With Polymorphic Has Many Through
Hi, seem to keep running into a wall here. I can''t find any resources on site navigation that can deal with any model being in the nav, allow nesting, and can dynamically update. So I thought about it for a while, and decided on a MenuItems class, which contained the position of the child in relation to it''s siblings, where the parent and the child were polymorphic. Then a given
2007 Oct 15
2
Association Help , 2 Teams playing a FootballGame
So I have the models class FootballGame < ActiveRecord::Base end and class Team < ActiveRecord::Base end I want to be able to do something like this @t1 = Team.create(:name=>"Michigan Wolverines football") @t1.save @t2 = Team.create(:name=>"Penn State Nittany Lions football") @t2.save @g = FootballGame.create(:hometeam => @t1, :awayteam => @t2) @g.save
2006 Feb 09
0
I need help on VICIDIAL and auto dial
Vicidial can't call and transfer to my softphone. I get some line that says Spawn Extension....exited on non zero.... Here's some of the CLI output. I am using Asterisk 1.2.4 and astguiclient 1.1.8 ...thanks for the help |SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='127.0.0.1' and campaign_id = '' and call_time <
2006 Mar 15
3
Self-referential join model does not work
I have been trying to model a labeled graph using ActiveRecord (trunk version). Basically, I have a ''Node'' model which represents a node linking to other nodes. Links (aka edges) are labeled (i.e., have a ''label'' attribute and other behavior). Thus I decided to model edges as an ''Edge'' model and use a ''has_many :trough''
2006 Jun 23
1
Describing a "replaces" relationship within the same model
Hi! I would like to describe the relationships between two objects of a model, where one of the objects replaces the other. I want to be able to tell if one object has been replaced and, if so, by what object; and vice versa what object an object replaces, if any. My idea was the following: create_table :events do |t| t.column :replacement_id, :integer t.column :description, :text,
2008 Sep 06
6
Active record question
I''m not quite sure how to get at this data using Actrive record.. I''m trying to get all the appointments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I''m looking for but how do I do it using Active Record? Select a.* from appointments a join resources r on r.id = a.resource_id join
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
No matter what I try I''ve been unable to work how to get this to work with the cool ActiveRecord helpers. I''m not sure if it''s possible, Josh Susser''s blog suggests it is, but damned if I can work it out... I have: Container which can contain one or more Element. An Element is a polymorph of either a Container or a Chunk. An Element can exist in one or more
2006 Jun 23
2
polymorphic challenge
Hello All, I have a little challenge and I am not sure if this is even possible I am working on a dating/event site and few functionalities are similar that I want to centralize them. We have users which can have - favorite users - interest list - blocked users All these relations are like; User <-> Relation <-> User I was thinking I could have a class called Relation (with a
2006 Feb 14
10
acts_as_versioned and getting authors
Hey guys and gals, I have the following object that has acts_as_versioned: class Note < ActiveRecord::Base acts_as_versioned belongs_to :user end The schema for my notes table is as follows: create_table :notes, :force => true do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :user_id, :integer t.column :title, :string
2006 Mar 07
13
Active Record - Can''t figure out relationship.
I have the following two tables: create table teams ( id int not null auto_increment, short_name varchar(12) not null, long_name varchar(50) not null, logo varchar(20) not null, primary key (id) ); create table rounds ( id int not null auto_increment, home_team_id int not null, away_team_id int
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi, We''re trying to rewrite veeeery old Rails app that we successfully managed to move to 1.2.6 and now we''re trying with 2.1.0. One of the problems is caused by :include in AR.find. Rails 1.2.6 generates totally different SQL query than 2.1.0. Here''s Rails find query and generated SQL queries: Foo.find(:all, :include => :ticket, :conditions =>
2013 Feb 08
1
Problem with many to many relationship
Hi I''m trying to create a many to many relationship between two models. A User can be associated with many Incidents and vice versa. class User < ActiveRecord::Base include ActiveModel::ForbiddenAttributesProtection has_many :incident_participants, foreign_key: "participant_id" has_many :participated_incidents, through: :incident_participants end class Incident
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup. class User < ActiveRecord::Base end class Parent < User has_many :relationships has_many :children, :class_name => "Student", :through => :relationships, :conditions => "related_as = ''parent''" end class Student < User has_many :relationships
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
2007 Jul 18
10
Rails - Mock going out of scope?
Hello list, I think I have a rails related RSpec problem with a mock going out of scope on a recursive call to a model. The code is at: http://pastie.textmate.org/79821 if you want to see it highlighted. I have pasted it below as well. Basically, I have an acts_as_nested_set model called "Node", which works fine. I have a function which finds the language name of the node instance.
2006 Jul 31
2
ambiguous column name in has_many :through
In my application model I have three classes: Accounts, Projects, and Items class Accounts < ActiveRecord::Base has_many :items, :through => :projects, :source => :items has_many :late_items, :class_name => ''Item'', :through => :projects, :conditions => [''due_on < ?'', Time.now], :source => :items end class Projects <