I think I have seen Ryan Bates do it one of his screencasts, but I can't find it.
I believe there is a command you can run while in script/console that lets you reload your models (if say you have made a change) so that you dont have to exit and then recall the console.
Any Ideas?
...
Hi there, I'm struggling myself trying to get the contents of a form which is a complex model and then update the model with that complex model.
My account model has many individuals
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult OpenAnAccount(string area,[Bind(Exclude = "Id")]Account account, [Bind(Prefix="Account.Individuals")] En...
Heyy there,
i have for example a view function like this:
def profile_view(request, id):
u = UserProfile.objects.get(pk=id)
return render_to_response('profile/publicProfile.html', {
'object_list': u,
},
context_instance=RequestContext(request))
and the url:
url(r'^profile_view/(?P\d+)/$',
...
In a rails model, is it possible to do something like
class Example < ActiveRecord::Base
#associations
validates_presence_of :item_id, (:user_id OR :user_email)
#functions
end
Where the model has 3 columns of :item_id, :user_id, and :user_email?
I want the model to be valid as long as I have a :user_id or a :user_email.
Id...
hello,
i want to make a notification function, and i need fields from 2 different models.
how can i access those fields?
in my notification view i wrote this
data = Notices.objects.filter(last_login<date_follow)
where last_login belongs to the model class User , and date_follow to Follow
but it is not a proper and correct way of acc...
In a CakePHP application, for unique constraints that are accounted for in the database, what is the benefit of having the same validation checks in the model?
I understand the benefit of having JS validation, but I believe this model validation makes an extra trip to the DB. I am 100% sure that certain validations are made in the DB so...
I've got some material parameters stored in the FBX file (DiffuseFactor, ShininessExponent, SpecularFactor and others), but I can't get to them using Effect.Parameters nor BasicEffect (they've got only the basic stuff - like EmmisiveColor or alpha). I know, that I can try to write a Effect-derived class, but is there any other way? A bui...
I know normally the data is passed thru to the view with the controller. however, currently in my view I load my model ($this->load->model('Db_model');) so i can use it in a loop to retrieve a users profile picture path from a array of IDs that is passed from controller. Will loading the db model in the view to accomplish this make my si...
Hi Everyone,
In my rails application I have two models called Kases and Notes. They work in the same way comments do with blog posts, I.e. each Kase entry can have multiple notes attached to it.
I have got everything working, but for some reason I cannot get the destroy link to work for the Notes. I think I am overlooking something tha...
So I am trying to emulate google app's status page: http://www.google.com/appsstatus#hl=en but for backups for our own servers. Instead of service names on the left it'll be server names but the dates and hopefully the pagination will be there too. My models look incredibly similar to this:
from django.db import models
STATUS_CHOICES...
I have a Rails 2.3.5 application and Im trying to render several Partials from within a Model (i know, i know -- im not supposed to). The reason im doing this is im integrating a Comet server (APE) into my Rails app and need to push updates out based on the Model's events (ex. after_create).
I have tried doing this:
ActionView::Base.n...
Hi there,
I want to improve the program so it has a proper constructor but also works with the models environment of MVC.
I currently have:
public void recordDocument(int order_id, string filename, string physical_path, string slug, int bytes)
{
ArchiveDocument doc = new ArchiveDocument();
doc.order_id...
I have a table of Hits, Articles and Categories
Now, a Hit belongs_to an Article/Category (depends on where it was done).
so I have a column on Hits table with the name 'parenttype'
That tells me 'Article' or 'Category'.
I wrote in the Hit model (extends ORM)
protected $_belongs_to= array(
'page' => array('model'=> $this->parent...
I need to load controllers and models from a different folder than the default one. I am using a Linux system.
I am building a simple CI application for some people, for use on a shared hosting I own. But I want to give them access only to /views folder and some /config files. And this is why I need to store the controllers and models ...
I am trying to make a form on one page that uses multiple models. The models reference each other. I am having trouble getting the form to validate because I cant figure out how to get the id of two of the models used in the form into the form to validate it. I used a hidden key in the template but I cant figure out how to make it work i...
what field in the django models class should be used if the type of data (text/images/html) is unknown? i'm looking for a field that can handle copy and pasted html code, images, text, etc.
...
I have three models: paste, snippet and tutorial. I want to show the newest of all of them mixed in one list, like this on the page:
<ul>
<li>Just a paste</li>
<li>The worst snippet ever (-10202343 kudos) (1 quadrillion comments)</li>
<li>Just another paste</li>
<li>Ruby on Rails tutorial (5 kudos) (2 comments)</li>
<li>Another snippet<...
Hi,
I have a django.contrib.contenttypes.generic.genericForeignKeyField as a member of my model,
however, it is not appearing when I instantiate the model and then try to get the fields out of the _meta of the object.
e.g:
class A(models.Model):
field2 = models.IntegerField(...)
field1 = generic.genericForeignKeyField()
a...
Hello all
I am trying to implement form validation using cakephp models. Here are my code snippets...
Model
// File: /app/models/enquiry.php
class Enquiry extends AppModel {
var $name = "Enquiry";
var $useTable = false;
var $_schema = array(
"name" => array( "type" => "string", "length" => 100 ),
"ph...
Hello all
I am trying to implement form validation using cakephp models. Here are my code snippets...
Model
// File: /app/models/enquiry.php
class Enquiry extends AppModel {
var $name = "Enquiry";
var $useTable = false;
var $_schema = array(
"name" => array( "type" => "string", "length" => 100 ),
"ph...