model

Rails not adding model field to insert query

Hi, I've added a column to a db in rails via a migration, and updated new.html.erb to add the field to the form. The correct data is in the request params, but the insert query that is generated has a null for the column every time. Here are the request params: {"commit"=>"Create", "assignment"=>{"start_date"=>"08/04/2010", "proj...

How to apply this filter in Rails

Hi, I have a table called as language which has a column called as lang_code. It has the following values. id lang_code created_at updated_at 1 ARA 2010-07-29 15:27:25 NULL 2 CHI 2010-07-29 15:27:25 NULL 3 DAN 2010-07-29 15:27:25 NULL 4 DEU 2010-07-29 15:27:25 NULL 5 ESP 201...

How to create UI and Model based on some business logic

I had following business logic. In this Op1 and Op2 represents some operation. And param1,param2,... represents parameters required for executing these operations Op1=param1, param2 Op2=param1, param2, param3 Now in UI I had a drop down list containing "Op1" and "Op2". Following should happen based on my business logic 1) If I select o...

GUI Design Pattern , MVP, Tab Control

Hi, I have an application that has a window similar to the one bellow . The requirement here is that when the user clicks the Save button everything has to get saved. The "Save" and "Reset" buttons are "common" to all tabs. Hence, when the "Personal Information" tab is selected and "Save" is clicked the program should also save chang...

Database access abstraction classes

Currently, I have a database access class named DB, which uses PDO. I Then have a handful of sub-classes for accessing each table: Users Images Galleries Text Videos This was nice when I first started my project, but now I'm not sure if it's that great, as I have a method for each database query that I use within each of these classe...

how to detect model belongs to which plugin in cakephp?

How to detect in AppModel, model that is loaded, belong to which plug-in? EDIT: When I check model name or other details in AppModel, there is no difference between the model loaded from the main program and a model that within the plugin loaded. I need to know if model belongs to the plugin to do some operation on it. ...

MVC: Model, method arguments or direct inputs.

Hello I saw this case in the Codeigniter Users guide where they introduced the model. I just wonder why they took values straight from the input in the model and didnt pass them as methods parameters for it.. Is it a bad practice to do it like that? Im considering to refactor my own framework... ...

How to get all models,controller,action and method names in Rails

Hi guys, In runtime we can get the current controller and current action names by controller_name and action_name methods like wise, I want to get all the remaining controllers and action names and models too if possible.. Any rails method available to get all the controller names and the action names in application controller. ...

How do you document your JavaScript?

Hi, I need to document quite a lot of JavaScript and jQuery code. I'm interested in diagrams, rather than the written documentation. I'm wondering if there is some sort of standard for modelling the JavaScript functions? My goal is to show visualy how different functions interact with each other. Thank you Edit: I have been trying D...

Rails - Refer to current object in model

I must admit, I am not even sure if I put the question right... In my app I have a bunch of named scopes to build more efficient finds. The one that I can't get to work is this: => I want to find all products in the current category and its descendants. I use the 'ancestry' gem to build the tree, and it provides named scopes on the Cla...

How can I determine the Model by extracting the name of another Model?

I have several models: ContactEmail, ContactLetter, ContactCall My controller doesn't know what is being passed into it. It only knows it as an event (so event can be specific instance of ContactEmail, ContactLetter, ContactCall) Each of these has a different attribute. ContactEmail has email_id; ContactLetter has letter_id, Contact...

Django Haystack substring search

I have recently added search capabilities to my django-powered site to allow employers to search for employees using keywords. When the user initially uploads their resume, I turn it into text, get rid of stop words, and then add the text to a TextField for that user. I used Django-Haystack with the Whoosh search back engine. Three thin...

Django - how to extend 3rd party models without modifying

I want to add a column to a database table but I don't want to modify the 3rd party module in case I need/decide to upgrade the module in the future. Is there a way I can add this field within my code so that with new builds I don't have to add the field manually? ...

Rails - How should one organize their model code?

Hello, I'm sorry if this seems over simplified but I'm wondering quite specifically what the general consensus is on how model code should be organized. Association declarations, if you think certain association types should be declared before others, accepts_nested_resource declarations, validations, custom validations, protected and p...

Model, Business Rules and Persistence

Hello all, I'm having trouble figuring out the best approach for an certain application. I'm not really used to newer architectures that superseded old TLA (three layer architecture), so that's where I'm coming from. When designing the Model and the DAL for my application (POCO classes, right??), I got the following doubts: Should my...

Can a utility class be a Model class in a MVC framework?

Im designing a MVC framework but I dont know where should I put my utility classes. I read somewhere where it said utility classes are Model Classes. Is this line of thinking correct or are they some separate type of class? ...

Application design for 5 years

My question is not technical. It's more of a philosophical and really down to individual preference. I am designing and developing an application (web + desktop) and this just occurred to me and was wondering if you guys (programmers and designers) ever came across this before: Some designers believe in making applications that will run...

How to persist application model

My c# application needs to persist its model classes to disk. Initially I tried to do xml serialization. However when I do breaking changes in my model (split one class to two) the saved xml will not deserialize (which is understood). I thought about applying xslt to upgrade the xml but the xml generated is really complex. Is it a good...

Enabling 2 different models in a rails app talk to the same table

I'm having a few integration issues. I have 2 models which need to be mapped so as to enable them to talk to the same table. So one model has a few attributes that are mapped to the corresponding columns in the table and likewise for the other model. I've heard of aliasing, a technique that can be used. Help would be appreciated. Thank...

SQL DataSet using Model

Help I am attempting to create some report on a report server model. I need to create a text type DataSet, using sql. Once I have written the SQL and click on OK it attempt to load back into Design>>Data view, but fall over. It show the below error A connection cannot be made to the database. Set and test the connection string. Add...