Hi there,
Can anyone help, I have been using linq2sql with great success using my associations (foreign keys) to provide inner joins etc...
for example this, works great, the color is stored in a table called Color which has association so i pick it up via Color.Description - Excellent. Same for StructureType its actually an associati...
Hi there,
Can anyone help?
I have the following structure using associations, and as you can see v.StructureType.Description works great as its a 1 to 1 association, but i need to get in my example below v.StructureGroup.StructureGroupTariffs.Tariff.Price but StructureGroupTariffs is a Pivot table to interlink the StructureGroup and Ta...
In Objective-C I need to associate a mutable collection integers (monotonic, non-contiguous, could get fairly large) to boolean values. The obvious way is just to have an NSDictionary w/ NSNumbers as keys and values.
Is there a better way that doesn't involve so much object creation? I'm really not trying to pre-optimize so much as lea...
I want to (as an example) create a has_many association to all posts by friends of a person, something like has_many :remote_posts to give me something like person > friends > person > posts.
..here is how I would go about it
script/generate model post title:string person_id:integer
script/generate model friendship person_id:integer f...
Hey guys. I'm new-ish to rails development and have hit a bit of a wall. The application I'm working on is a scheduling solution that requires updating a join model, but not in a simple 1:1 sort of way.
The app is laid out as follows:
class Route < ActiveRecord::Base
has_many :markers, :foreign_key => 'source_id'
has_many :schedu...
I am trying to write an application to track legal case requests. The main model is Case, which has_many Subjects, Keywords, Notes, and Evidences (which, in turn, has_many CustodyLogs). Since the application is legal-related, there are some requirements that are out of the ordinary:
CRUD operations must be logged, including what the ...
So I've created a dbml in my project, which has three tables: Elements, ElementImages and Images. Every Element record could have multiple ElementImage records and each of those ElementImage records should have one Image record. The primary and foreign keys are all set up correctly and the associations are defined correctly as well. ...
I have badges (sorta like StackOverflow).
Some of them can be attached to badgeable things (e.g. a badge for >X comments on a post is attached to the post). Almost all come in multiple levels (e.g. >20, >100, >200), and you can only have one level per badgeable x badge type (= badgeset_id).
To make it easier to enforce the one-level-p...
I am converting a project from another ORM to Entity Framework. I have a table where all 3 fields are foreign keys. So this table has been automatically mapped as an Association Set. In the previous ORM I could still work with this table as an entity - writing linq statements against it, adding and deleting objects etc. Is it possibl...
What's the difference between Association and Dependency? Aren't they both the same thing? as if class A is associated with B then Class A is dependent on B ie. there's a dependency between A and B.
...
Hello, I don't understand the workaround with the virtuell attribute.
Form Railsforum by Duplex
URL: http://railsforum.com/viewtopic.php?pid=110698#p110698
His solution:
>
def type_helper
self.type
end
def type_helper=(type)
self.type = type
end
<
My application is based on RailsCast part 73,74,75 complex_forms
I have two models...
Following are the 1-to-M models:
class FotoGossip < ActiveRecord::Base
has_many :uploads
attr_accessible :published_at, ...
end
class Upload < ActiveRecord::Base
belongs_to :foto_gossip
end
Now I want the Uploads.all with the condition :published_at NOT NULL of the corresponding upload's parent model?
...
Hello,
I am using CakePHP 1.2. I have a person model that hasMany 'Document'. When I edit a document, the select box for the owning person appears (echo $form->input('person') where person has been defined in the documents_controller like this:
$allPeople = $this->Document->Person->find('list', array('fields' => array('first_name')))...
Apologies if this is a slightly noob question, but looking to clarify my thoughts on this. I have a model that can EITHER belong to one model, or another. For example:
Let's say I have a Team model and I have a Member model, and both of those models can have one BankAccount.
class Team
has_many :members
has_one :bank_account
end
c...
I have two associated business objects - A and B.
the association is (A->B)many-to-one, with B.Id a foreign key in A (so A has A.B_id in the DB).
I'm using lazy=true and solved most of my problems,
however in A's ToString I want to print also A.B.Id, which I should have without further trips to the DB. but accessing A.B activates the pr...
I have the following inheritance hierarchy.
@Entity
@Table(FRUIT)
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColum(name="FRUIT_TYPE",discriminatorType=STRING)
public class Fruit {
..
@Id
private FruitId id;
...
}
@DiscriminatorValue("APPLE")
public class Apple extends Fruit {
...
@ManyToOne
private FruitBowl bowl...
I have been hearing a lot of buzz around has_many :through(HMT) vs has_and_belongs_to_many (HABTM). This post covers most of its benefits. Okay, HMT sure has some real good benefits over HABTM. However, what I wanted to know that when should I know that I should be using HMT over HABTM? Often I am in a situation where I believe that plai...
I can't seem to wrap my head around this, so I thought I'd post and see if anyone could help me out (please pardon the question if it's insultingly simple: it's complicated to me right now!)
I have these models:
order
service
customer
I think they speak for themselves: a service is what the customer buys when they place an order.
O...
Hello,
I'm building two programs, a text editor and a zipper, but in this two programs I want to associate a file type to they, but how can I do this? Thanks.
...
Hi, I am having some issues with CakePHP's find() method and conditions in 'deeper' model associations. There are some of these around but I could not find an answer to this so far.
My model associations are User hasMany Post hasMany Comment hasMany Vote and Vote belongsTo Comment belongsTo Post belongsTo User respectively. The belongsT...