The navigation property of the entity infrastructure is null

I have two models using Entity Framework. public class Player { public int PlayerId { get; set; } public string Name { get; set; } public string Sex { get; set; } public string Plays { get; set; } public string FavouriteSurface { get; set; } } public

Rails 4 - showing errors in a model that is not Enableecord

I have a tableless model (i.e not saving in the DB), in order to manage a form. After following the instruction set in a Railscast episode, it's mostly working: class PaymentRequest include ActiveModel::Validations include ActiveModel::Conversion ext

Help methods for templates in Rails

Is there a proper place for helper methods for models in Rails? There are helper methods for controllers and views, but I'm not sure where the best place to put model helper methods. Aside from adding a method to ActiveRecord::Base, which I'd prefer

Laravel 4 Creating form to add a record with relationship

I have created very basic Model. I have persons table and emails table. Also I have create a link in the persons/show.blade.php ("Add mail"). My models are class Person extends Eloquent { protected $table = 'persons'; public function email() { r

How to subclass QStandardItemModel to use my own item type?

How do I subclass QStandardItemModel to use my own Item type (e.g. MyItem instead of QStandardItem)? I mean I know I have to create a class and inherit QStandardItemModel but what next? How do I make it use MyItem everywhere? And yes, MyItem inherits

Rails - mismatch of the superclass

Playing with Rails and controller inheritance. I've created a controller called AdminController, with a child class called admin_user_controller placed in /app/controllers/admin/admin_user_controller.rb This is my routes.rb namespace :admin do resour

Extend the basic model in Magento

I'm trying to extend: Mage_Catalog_Model_Product_Visibility I'm modifying the following in the Visibility.php file: public function getVisibleInSiteIds() { return array(self::VISIBILITY_IN_SEARCH, self::VISIBILITY_IN_CATALOG, self::VISIBILITY_BOTH);

How to model different users in Rails

Question I have a User model with authorisation and authentication logic built. Now I realise I have three different types of users. I want to store different information about each of them. What is the best way to handle this in Rails? Thoughts base

Rails template error

I've a component model that has_many :framework. But the :framework don't belongs_to :component, because a framework could belong to lots of components. I've a controller that returns a json with the frameworks of a concret component: def getFramewor

Possible to simulate a simple CPU in prologue?

My understanding is that a simple model of a CPU is a state machine. When I look at prolog, it appears to tree-search (or graph search) combinations, whilst stopping at constraints running until its goals are found. I've been told that you can simula

Django Abstract Pattern Inheritance

In a model I usually put a "uuid" field for friendly URI, also a "slug" field. Say I have a model named "SomeModel", by overriding its save() method, I can generate a uuid and a slug when it's being saved: class SomeModel(mod

Objective c - Letter & amp; Pattern of points

I'm developing a word game and basically I want to assign an integer value to each character of the alphabet. Currently, I have a helper to return the value for each char but I'm wondering how I should construct the initial data structure. At the mom

Yii - controller - Function to change a flag / boolean on db

I'm working on a project with Yii. I am working on the backend, at the moment. I'm implementing a function in a controller that should load a model, change a value in the database (a tinyint that changes from 0 to 1) for that particular model and red

Generate templates from existing tables using Rails 3

Using Rails 3.2.2 and ruby 1.9.3dev and mysql I am new to ruby and rails. We have an existing database with a couple hundred tables. We would like to try out rails to see if it would be a positive change from PHP & ZendFramework. Migrating data into

django - initialize model fields including manytomanyfields

All, I have a set related models: class Foo(models.Model): fooName = models.CharField() bars = models.ManyToManyField("Bar") class Bar(models.Model): barName = models.CharField() When I create a new one, I would like for it to have a default set

Missing table_name_prefix Rails

I have got the following dir structure models/foo/setting.rb models/foo.rb foo.rb content module Foo def self.table_name_prefix 'foo_' end end and setting.rb content class Foo::Setting < ActiveRecord::Base end As soon as I am calling Foo::Setting.fin

PHP MVC Principles

I'm not using an off-the-shelf framework and don't particularly want to (nor d I want to go into the reasons why...). Anyway, onto my question(s), I hope it make sense.... I'm trying to get my head around what should go in the model and what should g

has_one: are conditions interpreted as attributes?

This association: class Business < ActiveRecord::Base has_one :map_address, :as=>:addressable, :class_name => 'Address', :conditions => {'addresses.map_address'=>true}, :dependent => :destroy end Causes this error: ruby-1.8.7-p334 :005 &

Translate the model value

What's the best way to handle the following problem with rails 3.0.3? I have a Model(id, name) Nationality, in which I store different nationalities ie: French, German, Belgian My application should be available in multiples languages, so the select

Does anyone know how to save many objects in one form?

I am trying to save many new objects in a form to one pre-existing parent object. - form_for :parent_object do |f| This is the beginning of my form. And then within it, I would do: - 2.times do - fields_for :child_object do |f| Now if I were to save

Resource Planning in Arena Simulation Software

I have a big problem in a simulation model. Entities arrive before and wait until 6.00 AM. And entities arrive after 6:00 AM, don't get any problems and walk inside. How does one model this in Rockwell Arena?I can't speak specifically to Arena, but i

Get validations for a Rails template

Given a model that has validations in the model_name.rb file, how can I access those validations manually? I'd like to cook up my own form validation system that would work alongside the built-in Rails tricks and I want to keep everything as DRY as p

Rails / ActiveRecord: Field Normalization

I'm trying to remove the commas from a field in a model. I want the user to type a number, i.e. 10,000 and that number should be stored in the database as 10000. I was hoping that I could do some model-side normalization to remove the comma. I don't

Model limit_choices_to = {'user': user}

I went to all the documentation, also I went to the IRC channel (BTW a great community) and they told me that is not possible to create a model and limit choices in a field where the 'current user' is in a ForeignKey. I will try to explain this with