I am currently designing simple editor as part of learning process. Its basicaly hierarchical tree structure of polygons-lines-points, that is implemented in data model. I need to display these data in two views
First view: hierarchical data in tree view item
Second view: rendered geometry on screen
Following the MVVM pattern i have ...
I have the following problem. I have a form which takes input for a "Chart" object. But after processing the form, i wish to display one of the values, and it adds the key of this value.
Class model
class Chart
attr_accessor :title, :series
def initialize(title = nil, series = [])
@title, @series = title, series
end
end
...
Hi,
I'm slightly confused about the controller-model relationship in MVC.
Should a controller be able to access any model in the system or should it have a 1:1 relationship with a specific model? Both options seem to present problems:
If the relationship is 1:1 obviously if something elsewhere needs to be updated it can't for example ...
Hello,
When I:
self.save
or
save!
in a model it automatically redirects me to the show view for that given model. How can I override this? I want to save the model and then go to another action/view in the same controller.
In particular, I have a process where I save a members details, and then I want to continue the process by g...
I have a model user, a feed, and a comment. user has many feeds and comments, feeds belong to user and have many comments and finally comments belong to user and feed.
No when i show feeds for a certain user, it selects all the comments made till date for every feed. I want it to select only those comments that were made in the last 1 m...
I have the problem with the sequence of joins. The similar problem was in another question http://stackoverflow.com/questions/3343348/manipulating-order-of-joins-in-cakephp. The answer was to use Containable behavior. In my case that is unacceptable because I have deeper associations and containable generates too many queries. Containabl...
I have the following database table:
And here is the code I use to validate the model created by Entity Framework:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace UTEPSA.Models
{
[MetadataType(typeof(Area_Validation)...
I have a message form which uses validates_length_of in the model to limit the length of the message.
validates_length_of :content, :maximum => 1024
I "tested" this by entering 5k or so characters and submitted the form. But I get this NoMethodError:
NoMethodError in Messages#create
Showing app/views/messages/_messages.html.erb w...
I'm using MVC 2.0 with a Html.ListBoxFor as below:
<% using (Html.BeginForm()) { %>
<input type="submit" value=">" />
<%= Html.ListBoxFor(x => x.lstTest, new MultiSelectList(new [] {"someone", "crap", "why"})) %>
<% } %>
When I click the input submit button below with nothing selected, it posts back fine, when I ...
You can create a new model in App Engine using a dictionary:
my_model = MyModel.get_or_insert(keyname, **kwargs)
Is there a way to update a model using a dictionary instead of doing the following?
my_model.firstprop = 'first'
my_model.secondprop = 'second'
...
I'm trying to make an app that does testing similiar to what you would experience in school.
I have a model Question, which can belong to either an Exam, Quiz, or Assignment.
Should I create fields for ":exam_id, :integer, :null => false; :quiz_id, :integer, :null => false; :assignment_id, :integer, :null => false;"?
The question w...
I would like to use DataAnnotations for basic client and server-side validation of my MVC ViewModels. My ViewModel looks like this:
public class MyViewModel
{
public Client Client1 { get; set; }
public Client Client2 { get; set; }
public Product Product { get; set; }
}
So I would like to check that both client objects have...
In GAE-python, you can model a one-to-many relationship by assigning a reference property to the child model.
class Book(db.Model):
title = db.StringProperty()
class Author(db.Model):
book = db.ReferenceProperty(Book, collection_name = 'authors')
is_primary = db.BooleanProperty()
name = db.StringProperty()
This way, I can ...
In kohana 2.3.4 system load first application, after modules and system. I want to extends User_Model in application with User_Model in modules. How to do that?
...
I am receiving the following error:
ActionView::TemplateError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?) on line #24 of app/views/index/index.html.erb:
21: <% @achievements.each do |achievement| %>
22: <%= achievement.name %>
23: ...
Hello,
I have a problem to get a value of textbox which is in view into the controller.
In WebForms it was quite easy, it needed just to call textbox in codebehind trouhg Id,
but in MVC it seems not possible this way, or?
Help me please!
Take care,
Ragims
...
have a legacy table with a field "LastModifiedDate", and I want to use that column as my "updated_at" column.
Is there any way to tell Rails to use that field?
Or, let me rephrase. :) ... How can I tell Rails to use that field? :)
Thanks!
...
I was following through on Alan Storm's tutorial on Magento's Model and ORM basics and I've run into a bit of a problem. When I get to the portion where I load from the Model for the first time I get this error "Fatal error: Call to a member function load() on a non-object...". I've reset everything already and tried again from scratch b...
Hi,
Does anyone know about a SQL statements parser, in Java, that would allow having an Object representation of a SQL query, allow modifying this representation and generate back the updated SQL statement?
Regards,
Christophe
...
Hello everybody,
can I use it like this in View?
<%= Html.CheckBoxFor(user => user.Role, "Administrator")%>
and then just read a value of property in model if checkbox is checked:
string role = user.Role;
(role = "Administrator")
Help me please!
Take care,
Ragims
...