Hi,
in our MVC application we use jQuery autocomplete control on several pages. All works fine on Create but I can't make it work on Edit. Effectively, I don't know how to make the autocomplete controls preload the data from model and still behave as an autocomplete in case the user wants to change the value. Also how can I make sure...
Hi All,
I have methods in all of my models that look like this:
def formatted_start_date
start_date ? start_date.to_s(:date) : nil
end
I would like to have something that automatically writes a method like this for each datetime field in each model, what's the best way to do this?
-C
...
When I have a given django model class like this:
class BaseClass(models.Model):
some_field = models.CharField(max_length = 80)
...
and some subclasses of it, for example
class SomeClass(BaseClass):
other_field = models.CharField(max_length = 80)
Then I know I can get the derived object by calling
base = BaseClass...
I would like bind an array data to view in ASP.NET MVC, how can I do that?
sorry for not clear about my question.
Right now, I creat a custom object(not array), I tried to pass it to View, but the error shows
"The model item passed into the dictionary is of type 'ContactView' but this dictionary requires a model item of type 'System.C...
Hi,
I've seen articles and blog posts indicating what I am attempting to do should be supported; however, I have been unable to get it working so hopefully someone can confirm that it does/does not work and/or tell me what I am doing wrong.
I have a "complex" model (Invoice containing a List of InvoiceItem) that I am attempting to bind...
I've been working through the NerdDinner Tutorial and most of it makes sense. What I'm not sure about is why the Repository is used directly in the Controller and not the Model objects. For instance, if we wanted to implement our own membership system and it had an AccountController with a Login method, what would be the best solution fo...
Which would you recommend - a deep objects hierarchy (where each object hold a reference to it child objects), or flat objects (where you provide services to retrieve child objects)?
Let's assume that you are creating a database management application. You will have objects such as:
Server
Database
Columns
Views
Which option would y...
I feel bad asking this question, as I thought I knew enough about Activerecord to answer this myslef. But such is the way of having SO available ...
I'm trying to remove the commas from a field in a model of mine, I want the user to be able to type a number , ie 10,000 and that number be stored in the database as 10000. I was hoping th...
Hi everyone, I am writing an app that listens on a network connection, and when some data arrive, it replies back, and depending on incoming data, it may need to ask user (show dialog) before replying back.
I don't know how to do this cleanly in M-V-VM architecture: the events and binding to observable collections are nice if I need to ...
I am trying to conceptually work through a model for a client-server socket application I am writing in c# (both client and server). My server will need to handle many clients at once, and preferably multiple requests from a client at once. I have worked out a container for my communication where I will send a fixed length header at t...
A bit of a newbie question on rails associations.
I have a Bug model, and a Status model. Status is basically just a key/value pair table. Out of the choices available, I would say Bug has_one Status makes the most sense. However, according to this
Content belongs_to ContentTemplate. Go
back and look at how I described the
probl...
Expanding on recent_posts_on_self below, I want to add an all_recent_posts_on_self method but I'm not sure if it's possible using the syntax self.posts.find. On the other hand, all_recent_posts_on_class seems straightforward.
class User < ActiveRecord::Base
has_many :posts, :class_name => "Post" , :foreign_key => "author_id"
has_man...
I have the following Model pattern:
public abstract class PARENTCLASS {...}
public class CHILD_A_CLASS : PARENTCLASS{...}
public static class EXTENSION{
public static METHOD(this PARENTCLASS parent){...}
public static METHOD(this CHILD_A_CLASS child) {...}
}
Something like above, of course there will be more child (and grandchild)...
I'm new to rails and can't figure out this issue...
I have a controller
Admin::Blog::EntriesController
defined in app/controllers/admin/blog/entries_controller.rb
And I have a model called
Blog::Entry
defined in app/model/blog/entry.rb
When I try to access my model from the controller, I get a "uninitialized constant Admin::Blog...
I've been stuck trying to figure out why a counter cache on my (parent) BlogPosts table won't update from the (child) Comments table. At first I thought the answer provided in my earlier question might be the solution but something happened after I went to bed last night because when I woke up this morning and restarted my Rails console,...
Hi guys,
I have a model Post which has a expiry_date. I want to know what is the
best way to manage scalability in this case. 2 options:
Whenever I want to SELECT from the table, I need to include where
expiry_date > NOW. If the table Post grows like a monster, I will be in
trouble. Imagine after 3 years or more. Indexes will be huge ...
OK. This is insane.
I'm new to RoR and I really want to get into it as everything about it that I have seen so far makes it more appealing to the type of work that I do.
However, I can't seem to accomplish a very simple thing with RoR.
I want these controlers:
/admin/blog/entries (index/show/edit/delete)
/admin/blog/categories (index...
I have a directory called cron, inside my app directory. In the cron directory, I have put my cron file. How do I access the model inside my cron file?
Which is the best place to put my cron file?
edit:
I'm trying to execute the cron file, directly like ruby cron.rb
...
I have an existing model for my project. I would like to switch to Entity Framework but I don't want to replace my model with the model generated from EF.
Additionally, my model is very different from my database schema so any chances to use the model generated from EF and do all the required refactoring seems too hard.
Does exist any ...
If I say this in the controller:
@order = Order.new(params[:order])
What is required for this to work?
Does there need to be a one-to-one match between all of the fields in params[:order] and the Order model?
Or can there be more or fewer fields in params[:order] than are required to instantiate an Order?
...