Given the three models “message”, “profile” and “comment” i want to merge them into one list, ordered by their common attribute “created_at”. I want to accomplish something like the project overview in Basecamp - see 3) here: http://basecamphq.com/tour#overview
...
Hi there,
What would be the best way to send a complete post to a model in Code Igniter? Methods I know are as follow:
Name form elements as array, eg.
<input type="text" name="contact[name]">
<input type="text" name="contact[surname]">
and then use:
$this->Model_name->add_contact($this->input->post('contact'));
The other would ...
I usually see Ruby on Rails books using
script/generate model Story name:string link:string
which is a singular Story, while when it is controller
script/generate controller Stories index
then the Story now is Stories, which is plural.
Is this a standard on Ruby on Rails? Is it true in other MVC frameworks too, like CakePHP, Symf...
In Ruby on Rails, say a Story object can "has_many" Vote objects (a story is voted "hot" by many users).
So when we do a
s = Story.find(:first)
s is a Story object, and say
s.votes
returns []
and
s.votes.class
returns Array
So clearly, s.votes is an empty Array object.
At this time, when
s.votes.create
is called, it act...
On Ruby on Rails, say, if the Actor model object is Tom Hanks, and the "has_many" fans is 20,000 Fan objects, then
actor.fans
gives an Array with 20,000 elements. Probably, the elements are not pre-populated with values? Otherwise, getting each Actor object from the DB can be extremely time consuming.
So it is on a "need to know" b...
Hello,
I am working on editors created with GMF and struggling with OCL right now.
Is there a possibilty to prevent a node to be created if an OCL statement in the mapping evaluates to false? If tried adding an OCL statement to a node and all it does is making the node not visible in the editor, but it is created.
There is also an OC...
I'm having trouble where to put our data model in our Prism app. Most, if not all or our data will be coming from web services and the web services are unique for each module. Unfortunately, there will be objects that need to be shared (such as a person/user object).
I'm really torn about whether to add these services directly to the ...
I have a model called Stem. I need a 'thumbs up' feature, so I have created a second model called Thumb, which consists of stem_id and user_id.
I'm also using the restful authentication plugin for user credentials.
I have the 'thumbs up' button working, which adds a row to the thumbs table fine, but I'd like to be able to check if the ...
Hi,
i don't understand this little thing:
Suppose, we have "Condition" model
class Condition < ActiveRecord::Base
end
Why Condition.all works ?
Condition.all.each { |p| do_something }
This syntax tells us, that we have "Condition" class-object instanciated somewhere ?
Or is it some convention over configuration case ?
I asking ...
I'm following the ACL tutorial for CakePHP 1.3 and I was wondering if there is a functional difference between declaring a behavior like this:
var $actsAs = array('Acl' => 'requester');
and like this:
var $actsAs = array('Acl' => array('type' => 'requester'));
...
Hello,
I'm working on a project where the data model is :
implemented in a separate gem
does not use ActiveRecord, nor any relational database storage ( actually it relies on couchdb )
makes usage of namespaces
makes intensive usage of class inheritance
To simplify the schema, let's say we have the following root class :
module ...
Google is proposing changing one entry at a time to the default values ....
http://code.google.com/appengine/articles/update_schema.html
I have a model with a million rows and doing this with a web browser will take me ages. Another option is to run this using task queues but this will cost me a lot of cpu time
any easy way to do th...
Hi,
I have a shopping cart system in Cakephp, this table has all your usual maguffins: user_ids, product_ids, option_lists ect. It also has quantity.
I currently have some awful nested loops to check if the record is the same as any in there, if so add one to the quantity. If not add a new cart item.
This loop has to check associated ...
Hi
I recently started evaluating ASP.NET MVC. While it is really easy and quick to create Controllers and Views for Models with only primitive properties (like shown in the starter videos from the official page) I didn't find any good way to work with references to complex types. Let's say, I have these Models:
public class Customer { ...
I have a User model in my app, which I would like to store basic user information, such as email address, first and last name, phone number, etc.
I also have many different types of users in my system, including sales agents, clients, guests, etc.
I would like to be able to use the same User model as a base for all the others, so that ...
CakePHP 1.3.0, mysqli
I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, o...
Does anyone have any clue why this doesn't work as expected.
If i use the python shell and do
team.game_set
or
team.games
It returns an error
AttributeError: 'Team' object has no attribute 'game'
If i create a Game object and call
game.home_team
it returns the correct team object
Heres my model
class Team(models.Model):
...
I'm trying to override as_json in one of my models, partly to include data from another model, partly to strip out some unnecessary fields. From what I've read this is the preferred approach in Rails 3. To keep it simple, let's say I've got something like:
class Country < ActiveRecord::Base
def as_json(options={})
super(
:o...
Hay,
i have an app which essentially a conversation system (much like reddits)
Where a post can have multiple replies, and a reply and have multiplies, and a reply to a reply can have multiple replies (etc)
I've made the model like this
class Discussion(models.Model):
message = models.TextField()
replies = models.ManyToManyFi...
Hello to everybody!
I've some trouble with a find() on a model on CakePhp.
I have three model relationed in this way:
Project(some_fields, item_id)
------belongsTo-----> Item(some_fields, item_id)
------belongsTo-----> User(some_fields campi, nickname)
I need to do a find() and retrieve all fields from project, a field from Item and ...