model

MAMP and CakePHP call to model issue

I asked this question on the CakePHP google-group but didn't find any resolution, so hopefully will have better luck here. I've been developing on CakePHP for a bit and decided to have a localhost version on MAMP so that I could demo my app to people without being dependent on an Internet connection. We have a couple of complex MySQL q...

Getting a list of child entities in App Engine using get_by_key_name (Python)

My adventures with entity groups continue after a slightly embarrassing beginning (see Under some circumstances an App Engine get_by_key_name call using an existing key_name returns None). I now see that I can't do a normal get_by_key_name call over a list of entities for child entities that have more than one parent entity. As the Mode...

Model from existing table in Rails 2

Hi! I have a database with tables. I want to create a model in my Rails app from existing table. As i know, such functionality is available, and is done as follows: script/generate scaffold model_name --skip-migration Of course, i defined my database in database.yml file. Scaffold generated for me a model with controller and views. My...

Rails: define column names to model

I have an existing database(Postgresql). How can i create models from it? How can i pass column names for Rails? As if something like this: Person: Name :table_name_for_name_attribute Surname :table_name_for_surname_attribute PersonalCode :table_name_for_perconal_code_attribute Unfortunately, my database is not following Rails convent...

Using my own model with GWT

I want to use my own existing model in GWT application. From what I've seen, GWT requests that model is placed in the ...gwt.client folder or one of its subfolders. However, my folder is in .jar file in the WebContent/lib folder of my project. I've tried including my project by placing this line in MyModule.gwt.xml: <source path="my.cl...

Does Excellent free modeling software exist?

My friends are in a class that is requiring class diagram modeling. We have access (legit) to Enterprise Arch but we all really hate it. And Visio isn't meant for class modeling (at least in our opinion). Is there a good free solution for class diagram modeling? Thanks! ...

Files in domain model

What are the best practices for dealing with binaries in domain model? I frequently must associate images and other files with business objects and the simple byte[] is not adequate even for the simplest of cases. The files: Does not have a fixed size and can be quite large thus: Have to be streamed or buffered, preferably in asynchr...

An object with the same key already exists in the ObjectStateManager...

I have an entity model with (among others) following four entities: QCompany: - PK_Company - CompanyName - QAddress - a collection of addresses QAddress: - PK_Address - Streetname - QZipCode - QAddressType QAddressType: - PK_AddressType - Description QZipCode: - PK_ZipCode - ZipCode - Maildepot I try to do the following: I have an...

Working with models which don't have a single foreign key in CakePHP

I'm working on an application which has data imported from a foreign (and wholly unchangeable) source. I'll simplify some of the tables to explain the problem. Below are the tables with their primary keys. invoices (doc_number, date_printed, batch_number) headers (doc_number, date_printed, batch_number) deliveries (doc_number...

Reputation and point system models

I'm looking to implement a reputation-based point system for a QA site. I like Stack Overflow's model, but I was wondering if there's anything else like this out there. I was doing some research on the web, but couldn't find a good compiled list of reputation models. If there's a study of reputation models with pros and cons, that would ...

Rails unorthodox naming of models with abbreviations

In an application I am building I am storing an XML file in my database using the acts_as_tree association. I would like to name the class XMLElement but this throws rails off since the capitalization is non-standard. It is looking for XMLElement from the file name xml_element.rb. I tried changing the filename to x_m_l_element.rb to t...

Automate database table creation from within CakePHP framework

I'm trying to write a webapp with CakePHP, and like most webapps I would like to create an installer that detects whether the database has been initialized and, if not, executes the installation process. This process will be entirely automated (it assumes the database itself already exists, and that it is granted full administrative acc...

Rails - Namespacing models

Usually there are a lot of models in a Ruby on Rails project, so: Is it a good practice to namespace them (in modules/folders)? What are the downsides? EG: Shop category.rb details.rb Products category.rb base.rb etc (instead of ShopCategory, to have Shop::Category?) Should also the controllers be namespaced in the same man...

Symfony difference between <ModelName>.class.php and <ModelName>Table.class.php

Cuold someone explain me the difference between the Doctrine auto generated files .class.php and Table.class.php? For example in the Jobeet tutorial there's JobeetJob.class.php and JobeetJobTable.class.php (http://svn.jobeet.org/doctrine/trunk/lib/model/doctrine/sfJobeetPlugin/) I don't understand the role of each file and where I have ...

ObjectQuery, passing datetime in Where clause filter

How to pass in Date Time value here? ObjectQuery<Item> _Query = ItemEntities.CreateQuery<Item>("Item"); _Query = _Query.Where("(it.StartDate >= 11/4/2009 5:06:08 PM)"); my sample code above does seem to work. even with this ObjectQuery<Item> _Query = ItemEntities.CreateQuery<Item>("Item"); _Query = _Query.Where("(it.StartDate >= \"1...

Rails Modeling Question - Relationships and Primary Keys

I'm working on a rails site that I've inherited and am trying to troubleshooting some sub-optimal model behavior. I have users, songs, and songs_download, each of which is its own model. Here's the relevant line from the users model: has_and_belongs_to_many :downloaded_songs, :class_name => 'Song', :join_table => :song_downloads F...

Specify which model relations to load

I am a beginning Cake user but well versed in php and frame works in general (I used to use Code Igniter). How can I call the model below and only return the Artist records and the related ArtistImage records, not the Album records. class Artist extends AppModel { var $name = 'Artist'; var $hasMany = array('Album', 'ArtistImage'); ...

Where should calculation logic go in a Rails app?

Hi all, I have an app that models a House. The House has_many Rooms, Rooms has_many Lights and Small_appliances, etc. I also have a controller called Calculator that is how the app is accessed. Data is added to the house (and its rooms) using the Calculator controller. Then a report is generated, which is located at app/views/calculator...

Best way to model these Rails relationships

Hi, I have the following scenario that I want to model the best way for a Rails application. I have a contact model that belongs to a company. A contact can create an enquiry so contact can have many enquiries. The enquiry can have many messages that can be from and to many contacts. Messages can belong to an enquiry, a company or a...

[Rails] Can a model "belongs_to" either/or more than one model?

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...