I've only discovered a month ago the folly of directly accessing entities / models from the data access layer of an n-tier app. After reading about ViewModels while studying ASP.NET MVC, I've come to understand that to make a truly extensible application the model that the UI layer interacts with must be different from the one that the D...
I'm pretty new to Android and Java, though I've really been excited about what I've learned so far. I'm a little uncertain though on how to implement the Model layer.
I come from a background in PHP web applications with Zend Framework and the like. I'm used to having an ORM component, through which the Model maps to a database. I haven...
Basically, I have a users model in my rails app, and a fanship model, to facilitate the ability for users to become 'fans' of each other.
In my user model, I have:
has_many :fanships
has_many :fanofs, :through => :fanships
In my fanship model, I have:
belongs_to :user
belongs_to :fanof, :class_name => "User", :foreign_key => "fanof_...
Imagine a collection of objects such as World, Country, Region and City. World contains a list of Country objects, Country contains a list of Region objects etc.
I would like to represent this structure in a JTree and be able to add, remove and move objects around the tree.
Can I easily create a TableModel from this structure? World wo...
Hello all,
My current project requires me to assemble a .zip file containing HTML and text-only templates for a user to download, for importing into an email marketing program.
I've inherited this project, and currently the code uses a "fake" model (that is a model that does not directly correlate to a database table), in which it stor...
I'm working on a Rails application. I have a Module called Animals. Inside this Module is a Class with the same name as one of my Models (Dog).
show_animal action:
def show_animal
require 'Animals/Bear.rb' #Works
require 'Animals/Dog.rb' #Fails
end
So the first require definitely works, the seconds fails.
MissingSourceFile (no s...
Hello
I`ve been wondering this one thing about creating models.
If I make for example Page model. Is it the both: It can retrieve one row from the table or all the rows. Somehow Im mixing the objects and the database.
I have thought it like this:
I would have to make a Page-class that would represent one row in the table. It also would...
I'm trying to behave. So, instead of using following SQL syntax:
select *
from tableA INNER JOIN
tableB on tableA.id = tableB.tableA_id LEFT OUTER JOIN
( tableC INNER JOIN tableD on tableC.tableD_id = tableD.id)
on tableC.tableA_id = tableA.id
I'd like to use the CakePHP model->find(). This will let me use the P...
I've been struggling for quite a while to get this feature working:
I want my user to be able to select categories when uploading a photograph, but additionally be able to specify a comma-separated list of categories to create/find and associate with the photograph. I've had this working by using an attr_accessor :new_categories on the ...
My problem is in somewhere between model and controller.Everything works perfect for me when I use MVC just for crud (create, read, update, delete).I have separate models for each database table .I access these models from controller , to crud them . For example , in contacts application,I have actions (create, read, update, delete) in c...
I have a method which has domain name as a String parameter.
def modelName="Equity"
I want to use it like
def results=modelName.findAll()
Please guide me!
...
Sorry about the vague title, but i didnt know how to ask the question in one line :)
I have an order with nested itemgroups that again have nested items. the user specify the amount of item that he would like to have in each itemgroup. I would like to create these items in the create method of the orders controller when the order itself...
Hello, everybody
How do you usually convert business objects to presentation?
For example:
Business object Person { Id, FirstName, LastName, Patronymic ... } should be presented as "LastName F. P. " in html layout.
We use Presentation classes hierarchy to represent data ready for output from Business model.
Questions:
Will you k...
In rails guides it's described like this: "Objects will be in addition destroyed if they’re associated with :dependent => :destroy, and deleted if they’re associated with :dependent => :delete_all."
Right, cool. But what's the difference between being destroyed and being deleted?
I tried both and it seems to do the same thing.
...
I would like to list all posts that are connected with some specific category and classroom.
I have:
class Post < ActiveRecord::Base
has_many :category_posts
has_many :categories, :through => :category_posts
has_many :classroom_posts
has_many :classrooms, :through => :classroom_posts
end
class Category < ActiveRecord::Base
h...
class student < ActiveRecord::Base
has_many :projects
def has_a_teacher_by_the_name_of(name)
self.projects.any? { |project| project.teacher.exists?(:name => name) }
end
end
class project < ActiveRecord::Base
belongs_to :student
has_one :teacher
end
class teacher < ActiveRecord::Base
belongs_to :project
end
This does...
I am attempting to create an enrollment process similar to SO's:
route to an OpenID provider
provider returns the user's information to the UsersController (a guess)
UsersController creates user, then routes to the ProfilesController's new or edit action.
For now, I'm simply trying to create the user, then route to the ProfilesContro...
Hi, i want extend an entity framework model with a temporany attribute.
I need it only in a mvc form. I don't need save it in the db.
How can i do it?
...
I was hoping someone with an understanding on CakePHP could shed some light on a question I've been having.
Here's my scenario, I have a User this User has a Company which in turn has many Department and many Address. If I were to get a User could I expect to have access to the Company and all models associated with that Company?
So wo...
I'm having some issues with dealing with indirectly associated models in cakephp. My current model setup is as follows:
Deliveries hasOne License
License belongsTo Delivery
License hasAndBelongsToMany Product (and vice-versa)
License hasAndBelongsToMany ProductOption (and vice-versa)
I'm trying to save information about ALL of these ...