associations

windows 7 - add new file type extention

I want to add a file type extention called .phtml to the set association page. In this case I want eclipse to automatically open Zend .phtml files Control Panel\Programs\Default Programs\Set Associations ...

Associating Context based on Caller Id

I want to create an Android application that will allow me to associate context / look up caller-relevant information when a caller from my Contacts List makes a call (e.g. look up meetings scheduled with this person) ...

wrong class_name selected by ActiveRecord

Hay fellow developer, When I invoke @chapter.articles, rails yields the following error: uninitialized constant Sommaire::Chapter::Article Event if I specify *:class_name => "Sommaire::Article"*, it yields: uninitialized constant Sommaire::Chapter::Sommaire::Article Since I'm relatively new to rails (3.0.0), this has lost me ! Th...

Does an associaton behave differently than a relationship?

I'm using the entity framework My customer class has an AccountID property that includes account information from other tables (such as address and specific account info) by loading the other tables into the property based on their relationships. like this: tblAccount acct = new tblAccount(); tblCust cust; tblAddress addr; public Cus...

Can Rails models have too many associations?

Apologies if this question is a bit daft, but are there any negative repercussions if an app has a model or models with numerous associations? For a complex app requiring a User model, for example (eg. a social networking site), it's plausible that the model could have 15+ associations (has_many :posts, has_many :messages, has_many :phot...

ActiveRecord has_one relationship alongside a has_many relationship

I'm struggling to model a particular relationship with ActiveRecord. I currently have the following setup and working class Schedule < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord:Base belongs_to :schedule end with a database structure that looks like this: schedules - integer:id tasks - integer:id ...

How Can I Handle Parameters With Spaces in Delphi?

My program accepts input file names either as command line parameters or in a drag and drop operation or in Explorer by clicking on filenames with an extension that is associated with my program. The command line and drag and drop work fine, but it is clicking on the filenames in Explorer that causes problems when the filepaths of the ...

How Can I Get My File Association to Open Multiple Files in a Single Program Instance?

I have set up a file extension in the Registry for my program as Windows requires. In the Registry, under shell/open/command, I've got: "C:\MyProgramPath\MyProgram.exe" "%1" This works fine for me. When someone clicks on one or more files associated with my application, my application correctly opens the file(s) but each one is ope...

How do I get IDropTarget to work with my Drop Handler in Delphi?

I have associated a file extension with my Delphi 2009 program. I have been using the command line call method to pass the filename to my Delphi program so it can be opened. However, I found that when selecting multiple files, and clicking on them all at once, it opens each file in a separate instance of my program. I asked about this...

Rails Nested Attributes and Custom Validation

I'm fairly new to both Ruby and Rails (using 2.3.8), so forgive me if I'm missing something really obvious here but I've been struggling with this for a while and my searches have been fruitless. In my code I have Plans, and a Plan has many Plan_Steps. Each Plan_Step has a number (to indicate '1st', '2nd', etc). I have a form to update ...

Implementing ondelete restrict association in CakePHP

Hi I have Event belongsTo Venue association. When a user tries to delete a venue, I don't want it to happen when one or more event is associated with it. What's the most automagic way to do it? ...

Use authlogic to find the User record based on an associated record

Typically, with Authlogic, you would authenticate with some unique identifier (e.g. email or username) and a password. Authlogic does this by first finding the record by the identifier (User.find_by_email_address(email) or similar), then calling then .authenticate method on the returned object, which checks the password against the recor...

named_scope width has_many association and count

I have models: class User < ActiveRecord::Base has_many :user_skills end class UserSkill < ActiveRecord::Base belongs_to :user named_scope :rated, :conditions => "count_raters > 0" end I want to get count of rated skills. current_user.user_skills.rated.cont It works fine, but the generated SQL is a very strange. SELECT...

Is a polymorphic association appropriate here?

Here's what I'm thinking: class Widget < ActiveRecord::Base has_one :widget_layout end class WidgetLayout < ActiveRecord::Base belongs_to :widget belongs_to :layoutable, :polymorphic => true end class InformationalLayout < WidgetLayout has_one :widget_layout, :as => :layoutable end class OneWayCommunicationLayout < WidgetLayo...

Hibernate: Where do insertable = false, updatable = false belong in composite primary key constellations involving foreign keys?

When implementing composite primary keys in Hibernate or other ORMs there are up to three places where to put the insertable = false, updatable = false in composite primary key constellations that use identifying relationships (FKs that are part of the PK): Into the composite PK class' @Column annotation (@Embeddable classes only) or I...

What is the best way in SQL to swap the direction of a one-to-many relationship?

Okay, so for whatever reason I have ended up with a situation where the key is pointing the wrong way in a one-to-many. It was obviously never used as a one-to-many, only as a one-to-one, and now there is a need to expand one of those to be many, and the way the key was stored this turned out to be backwards. The images table has a t...

Relational database structure for Texas Hold'em poker data

Hello, I am planning a relational database to store poker game data (like what would be included in the hand histories). I would like help figuring out how to design the associations. It seems like there should be 4 models: Game, Hand, Player, and Action (single action of a given player, like raise, fold, call). Let me lay out what I h...

Automapper - Bestpractice of mapping a many-to-many association into a flat object

I have two entities: Employee and Team. What I want is an EmployeeForm that has the Name of the Team. How can I achieve this using AutoMapper? My current "solution" is the following: Mapper.CreateMap<Employee, EmployeeForm>() .ForMember(dest => dest.TeamName, opt => opt.MapFrom(x => x.GetTeams().FirstO...

Self referential association problem

Hi, I have the next models: create_table :categories do |t| t.integer :category_id t.integer :language_id t.timestamps end create_table :category_localizated_categories, :force => true do |t| t.column :category_id, :integer t.column :localizated_category_id, :integer end class Category < ActiveRecord::Base has_many :catego...

ActiveRecord association: create new association or reference existing if associated attributes match

I have two models below. They can be explained as follows: A report has a report_detail (which determines start/end months). Many reports can have the same report detail, but no two report details can be the same. class Report < ActiveRecord::Base # attr: name :: String # attr: report_detail_id :: Integer belongs_to :report_de...