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
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
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
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
I have two different Django models, "modelA" and "modelB", who only have two columns in common with each other: "EMAIL" and "NAME", with the rest of the columns in each model being different. I want to return a sing
I'm using Spring 3.1.1.RELEASE. I have a model with the following attribute @DateTimeFormat(pattern = "h:mm:ss a") private java.util.Date meetingTime; On my JSP, I have <form:select path="meetingTime"> <form:option value="
I'm currently fooling around with backbone.js and came across some wierd behaviour trying to create some relationships between models and collections. So here is my Model/Collection Element = Backbone.Model.extend({ name: 'element' }); Elements = Bac
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
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
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);
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
Can someone tell me what core function do Magento call for default store view to be set on the frontend? I searched it for hours in Mage/Core/Model and didn't found it.Method links provided for convenience. Mage::run('','store') Mage_Core_Model_App::
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
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
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
As the question stated, is there anyway I can get these values for every smartphone?It's not complete, but you can try https://github.com/mataanin/android-devices
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
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
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
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
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
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
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 &
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
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
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
Pretty Basic one here guys. I have a View which holds 2 textfields for input and a submit button <%using (Html.BeginForm("DateRetrival", "Home", FormMethod.Post)){ %> <%=Html.TextBox("sday")%> <%=Html.TextBox(&
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
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
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