model

Prevent zend framework tool from adding new models to module

Hello, How can i prevent zf-tool from creating models in module directories? When i add a model using The Zend Framework Tool (1.10.6) as follows: zf create model test zf creates my test model in the application/modules/admin folder. can someone tell me how to create a model in the default models map? As far as i know, the admin m...

Making a custom validator with regex..not triggering yet

Hey guys, I thought this would be fairly straightforward, but it's not it seems..maybe I'm just writing the syntax wrong.. In my model I'm checking for certain key words before_validation :deal_validation def deal_validation if self.description.match /(exp\s|expire|ex\s|print|mention|\/)/ errors.add(:description, "Now just a se...

CakePHP: Duplicating/Deep Copying a Tree Structure Easily?

Hi all, I am wondering is there an easy way to make a copy of a tree structure that consists of one model with a parent_id that actsAs a tree? I was thinking it should be easy to recursively go through a given tree, remove all ids and lft, rght fields; however, as I add the new fields parent_id won't match up correctly. I suppose it sho...

Object, entities, pocos, models etc

I have seen these terms used interchangebly on the web for objects (.Net). Could someone explain the difference between them. POCO Entity Model Domain Object Active Record Are Entities and POCO the same/similar? I normally think as Model objects as being part of the UI layer of an N-Tier architecture, is this correct? Are there ...

Same model being loaded twice though controller specifies 2 different models

Rails 3... I have a controller.. class OrdersController < ApplicationController def index @os_orders = OrlandoOrder.all @ct_orders = ChicagoOrder.all end end And then I have the two models defined... class ChicagoOrder < Order Order::ActiveRecord::Base.table_name_prefix = 'ct_schema.' end class OrlandoOrder < Order ...

Rails: How to name a attribute of a model in a specific way?

Hey Guys, i am searching for a solution of my little problem - maybe you wanna help ^^ I have in Ruby on Rails modeled to classes "Person" and "Contact". A Person can have many contacts and a Contact can have one specific person and describes this relation with a value class Person < ActiveRecord::Base has_many :contacts end class C...

Learning JBoss drools: what should be my model.

Hi all, I'm learning JBoss Drools and I'm playing with the genetics data from the hapmap project: ( http://hapmap.ncbi.nlm.nih.gov/genotypes/latest/forward/non-redundant/ ) . Each file in this directory is a table with the individuals at the top, the positions on the genome on the left , and the observed mutations for each individual/po...

How to join 2 models in rails, which are not really in any relationship?

I have 3 models, say Account, Comment and Status. Each Account will have many Comment and Status, but Comment and Status are not in any kind of relationship. I would like to query the Account's Comment and Status, and sort these comments and status by time. How can I make this? Thanks all. ...

How to save multiple individual records for a single model.

Hi, I have a model(friends), where user can export his friend's info from facebook. I want save friends info(id and name) into the mysql database. I am having trouble creating a form for the same using form helper as i dont know the exact number of friends for each user. Is there a easier way to save user's friends into the database...

Django: Edit multiple rows

Hi, I want a list of forms with permissions, and one save button.. Like this: http://www.freeimagehosting.net/image.php?c701b302fd.png But I can't get it working.. Some ideas? I try to do somethis like this: forms.py class ProjectPermission(ModelForm): class Meta: model = ObjectPermission exclude = ('content_type', 'obje...

Catching a database exception in a model.save or model.save! method?

Hello, I have two models that when saving certain types of data, it causes the database to throw an exception. I can convert the data before saving to avoid the exception, but the conversion is expensive and the exception happens very rarely. So, I was wondering if it's possible to create an override of the model.save method, and catch...

Rails route to model instance - by domain name

I have a Rails 3 application, say, with hotels, where hotels belong to parent areas. When a user hits the app (served by mongrel >> nginx), I want the domain name used in the request to decide what area of hotels to serve up (domain name >> area). To achieve this I can see two options: 1) Rewrite the URL with nginx, inserting the are...

Problem with model loading in Zend Framework

I have weird problem with zend framework basics. I have simple action in IndexController: public function updateusersAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); new Application_Model_Users(); } And a model I want to create is defined in application/models/Users.php ...

rails - root model or application model

Hey, I was just looking around rails and noticed there is an app controller but no app model. Is there no root model in rails ? if not where do you put a piece of code that needs to be in every model. Thanks, Alex ...

ASP.NET MVC2 Model Binding does not POST back hidden values

I have a /Register [GET] Action in the controller that pre-poluates a view-model with a string and an integer and returns: return View(myModel); I can see the string being populated in the textarea and the id being populated in a hidden input. Yet when the form gets POSTed, the string value is null and the int value is 0. I verified tha...

Filter through model or dao?

How should one go about filtering a series of domain objects according to user-defined criteria? Should the filtering methods be in the model or should they be in the DAO? ...

How to know whether a model is new or not?

class Post < ActiveRecord::Base end post = Post.new How do I judge whether the 'post' is a new model which is not pulled from the database? ...

Recommended Animated Model Format to Load in OpenGL

What is the recommended animated model format that a game programmer would load in OpenGL? I have taken a look at .md2 and .3ds formats available at some OpenGL tutorials. However, it would appear that they are both fairly old. Is there any well-supported model format that a contemporary game programmer would prefer? Thanks in advance....

Update model with latest autoinc id from database

Hello, which method do you prefer to update my newly saved customer with the last autoincremented Id ? Do you see any disadvantage in one of both methods? CustomerRepository.cs public int AddCustomer(Customer customer) { //.... return lastID; } BillingViewModel.cs //Method 1 SelectedCustomer.Id = _customerRepo.AddCustomer(Sel...

modify model istance

What is the best way to modify programmatically (add or delete information) a model conforming to a metamodel conforms to Ecore? ...