So I know that you shouldn't use UrlWriter methods in a model, but I wasn't sure what a better way to handle my current situation is.
Basically, I want to allow a User to post something to his facebook feed, and want to write a post_to_fb_feed(object) method in class User. Now, the URL of what is actually posted depends on the object, s...
When implementing Edit action, I add two methods for Get and Post: Edit(string id)
Ideally, they need have same signature. But of course this is not compilable. So I add a dummy parameter to HttpPost method (form in my case):
[HttpGet]
public ActionResult Edit(string id)
{
var user = Entities.Users.SingleOrDefault(s => s.UserID == ...
There are a lot of flexible, complete, cross-platform, et cetera, graphical user interface frameworks. Most of them provide many tools to turn software development easier. When building a desktop application in Qt environment, for example, one usually would have different file types, headers, implementation files, and user-interface file...
ASP uses STA threading model while ASP.NET uses MTA. What does it mean ?
...
Im trying to update some nested params from a form. I can see that the parameters im getting from the form is correct, however the database dont get updated.
the view
<% form_for @order do |f| %>
<% f.fields_for :itemgroups do |ff, i| %>
<% ff.fields_for :items do |fff| %>
<%= ff.text_field :text, :id => "textField", :disab...
I've read this somewhere but I can't find it now.
I'm trying to change the default "find" method on a model from the id to for example the name. So when I map resources to a model it uses the the name instead of the id.
I don't remember if this was a parameter in the resources command in the route file or if it was something you added ...
I'm trying to write a function to SELECT the least-recently fetched value from a table in my database. I do this by SELECTing a row and then immediately changing the last_used field.
Because this involves a SELECT and UPDATE, I'm trying to do this with locks. The locks are to ensure that concurrent executions of this query won't opera...
Hello, i have a ModelForm, in which i'm having a CharField, which is declared as unique in the Model.
But I have 2 problems:
1.If i fill in the form with a field having the same name i don't get an error message
2.I'd like this field not to contain white spaces
Is it possible to do that using a ModelForm?
Thanks a lot!
...
Hi I am working with asp.net model binding, I have got it working previously with html forms, the problem here is the UI client is going to be a rich client.
I have this controller action
public ActionResult CreateUser(User profile)
previously with html forms, as long as the form html input names matched the name of the properties of...
When i try to a edit a entry.. its creating a duplicate entry in the database.
i have made sure i add an hidden id field when i go to the edit form.
Restaurant
RestaurantAttribute
RestaurantContact
these are the models i am using.
tried reinitialize the id
$this->Restaurant->id = $this->Restaurant->id;
strange... in the db the ex...
Say I use a simple frontend for information passed on by a DAO that uses JDBC (without ORM). In other words, the class would have no attributes to speak of. Would this considered as a valid approach? What issues could it potentially cause and how could a class be designed to avoid them?
...
I'm pretty new to MVC, I'm trying to create a model that can be localized, but it doesn't seem like that would be possible given that I have to use a custom property attribute to define displayname and validation properties.
Is there a way to dynamically create the model metadata attributes (DisplayName, UIHint, etc..) as opposed to h...
I have Rails polymorphic model and I want to apply different validations according to associated class.
...
Ok! I have this model:
class my(models.Model):
name = models.TextField()
description = models.TextField()
created = models.DateTimeField()
def __unicode__(self):
return self.name
I'm gettin data to this model from mssql database and saving it. Something like this.
mysql_name='somedata' #this data come...
Can somebody explain to me when it's a good practice to use models in CI?
An article in wikipedia was referring to CI models as "entirely optional and are rarely needed" is that true in any way?thanks in advance!
...
Hello,
I’m a bit concerned about how to model this rather simple scenario the best way in UML and ERM. When designed it has to be implemented in C# (Entity Framework 4) and SQL Server 2008.
The case is that I have a person, who has a postal address. Now this address can be two types, either a postal box, or a house identifier (house nu...
I'm writing a db.Model class in google app engine that looks something like this:
class Cheese(db.Model):
name = db.StringProperty()
def say_cheese(self):
return name + "cheese"
For some reason, whenever I run:
cheese = Cheese(name = "smelly")
print thing.say_cheese()
I get a KindError - No implementation for kind 'Chee...
I'm trying to remove dollar signs and commas from my form input (for example, $1,000.00 => 1000.00)
I have the following following line in my before_validation method in my model:
self.parents_mortgage = self.parents_mortgage.to_s.gsub!('$,','').to_i
This is causing any number to be put through to zero out. Is there something wrong w...
Lots out there about changing model names only or mapping new models to existing tables, but nothing about renaming both at the same time. For now, I'm starting with the DB table and working my way out with Find/Replace in my code, but I'm surprised there isn't something better or at least someone who's tried it and written about it.
...
let's say I have model A with relation to B.
When I write:
$a = A::model()->findByPK(1);
$a->B->doSomething();
and now B may by changed (by other user for instance). When I write:
$a->B->doSomething();
it uses old values of B. What I should do to force to refresh value of B before doSomething().
...