Search Results

Search found 13838 results on 554 pages for 'disconnected model'.

Page 57/554 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • In partial view: "The model item passed into the dictionary is of type"

    - by Dave
    I lack understanding of some basic MVC concepts, despite all my searching. I created an MVC project in Visual Studio, which contains the partial view _LogOnPartial.shtml. I just want to access information within the view pertaining to the user, to put in a user dropdown menu. When I try to put this at the top of the partial view cshtml page I get the above error: @model MyProject_MVC.Models.UserRepository When I try this I also get an error: @Html.Partial("_LogOnPartial", MyProject_MVC.Models.UserRepository) 'MyProject_MVC.Models.UserRepository' is a 'type', which is not valid in the given context

    Read the article

  • Entity Data Model Wizzard not creating tables in EDMX file

    - by Shawn
    I'm trying the database first approach by creating an ADO.NET Entity Data Model using the Wizard with the Adventureworks2012 DB. Testing DB connection works, and the connection string is added to the App.Config. I'm selecting all the tables except the ones marked as (dbo) AWBuildVersion, DatabaseLog, and ErrorLog. When the Wizard finishes the .edmx file is blank, and if I view the file in XML view the EntityContainer is empty. I'm using VS 2010 & .NET Framework 4.0

    Read the article

  • PHP / Zend Framework: Which object would handle a complex table join?

    - by Thomas
    I think one of the more difficult concepts to understand in the Zend Framework is how the Table Data Gateway pattern is supposed to handle multi-table joins. Most of the suggestions I've seen claim that you simply handle the joins using a $db-select()... Zend DB Select with multiple table joins Joining Tables With Zend Framework PHP Joining tables wthin a model in Zend Php Zend Framework Db Select Join table help Zend DB Select with multiple table joins My question is: Which object is best suited to handle this kind of multi-table select statement? I feel like putting it in the model would break the 1-1 Table Data Gateway pattern between the class and the db table. Yet putting it in the controller seems wrong because why would a controller handle a SQL statement? Anyway, I feel like ZF makes handling datasets from multiple tables more difficult than it needs to be. Any help you can provide is great... Thanks!

    Read the article

  • populate CoreData data model from JSON files prior to app start

    - by johannes_d
    I am creating an iPad App that displays data I got from an API in JSON format. My Core Data model has several entities(Countries, Events, Talks, ...). For each entity I have one .json file that contains all instances of the entity and its attributes as well as its relationships. I would like to populate my Core Data data model with these entities before the start of the App (otherwise it takes about 15 minutes for the iPad to create all the instances of the entities from the several JSON files using factory methods). I am currently importing the data into CoreData like this: -(void)fetchDataIntoDocument:(UIManagedDocument *)document { dispatch_queue_t dataQ = dispatch_queue_create("Data import", NULL); dispatch_async(dataQ, ^{ //Fetching data from application bundle NSURL *tedxgroupsurl = [[NSBundle mainBundle] URLForResource:@"contries" withExtension:@"json"]; NSURL *tedxeventsurl = [[NSBundle mainBundle] URLForResource:@"events" withExtension:@"json"]; //converting the JSON files to NSDictionaries NSError *error = nil; NSDictionary *countries = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:countriesurl] options:kNilOptions error:&error]; countries = [countries objectForKey:@"countries"]; NSDictionary *events = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:eventsurl] options:kNilOptions error:&error]; events = [events objectForKey:@"events"]; //creating entities using factory methods in NSManagedObject Subclasses (Country / Event) [document.managedObjectContext performBlock:^{ NSLog(@"creating countries"); for (NSDictionary *country in countries) { [Country countryWithCountryInfo:country inManagedObjectContext:document.managedObjectContext]; //creating Country entities } NSLog(@"creating events"); for (NSDictionary *event in events) { [Event eventWithEventInfo:event inManagedObjectContext:document.managedObjectContext]; // creating Event entities } NSLog(@"done creating, saving document"); [document saveToURL:document.fileURL forSaveOperation:UIDocumentSaveForOverwriting completionHandler:NULL]; }]; }); dispatch_release(dataQ); } This combines the different JSON files into one UIManagedDocument which i can then perform fetchRequests on to populate tableViews, mapView, etc. I'm looking for a way to create this document outside my application & add it to the mainBundle. Then I could copy it once to the apps DocumentsDirectory and be able I use it (instead of creating the Document within the app from the original JSON files). Any help is appreciated!

    Read the article

  • Django save_m2m() and excluded field

    - by jul
    hi, in a ModelForm I replaced a field by excluding it and adding a new one with the same name, as shown below in AddRestaurantForm. When saving the form with the code shown below, I get an error in form.save_m2m() ("Truncated incorrect DOUBLE value"), which seems to be due to the function to attempt to save the tag field, while it is excluded. Is the save_m2m() function supposed to save excluded fields? Is there anything wrong in my code? Thanks Jul (...) new_restaurant = form.save(commit=False) new_restaurant.city = city new_restaurant.save() tags = form.cleaned_data['tag'] if(tags!=''): tags=tags.split(',') for t in tags: tag, created = Tag.objects.get_or_create(name = t.strip()) tag.save() new_restaurant.tag.add(tag) new_restaurant.save() form.save_m2m() models.py class Tag(models.Model): name = models.CharField(max_length=100, unique=True) class Restaurant(models.Model): name = models.CharField(max_length=50) city=models.ForeignKey(City) category=models.ManyToManyField(Category) tag=models.ManyToManyField(Tag, blank=True, null=True) forms.py class AddRestaurantForm(ModelForm): name = forms.CharField(widget=forms.TextInput(attrs=classtext)) city = forms.CharField(widget=forms.TextInput(attrs=classtext), max_length=100) tag = forms.CharField(widget=forms.TextInput(attrs=classtext), required=False) class Meta: model = Restaurant exclude = ('city','tag') Traceback: File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/home/jul/atable/../atable/resto/views.py" in addRestaurant 498. form.save_m2m() File "/var/lib/python-support/python2.5/django/forms/models.py" in save_m2m 75. f.save_form_data(instance, cleaned_data[f.name]) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in save_form_data 967. setattr(instance, self.attname, data) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in set 627. manager.add(*value) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in add 430. self._add_items(self.source_col_name, self.target_col_name, *objs) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in _add_items 497. [self._pk_val] + list(new_ids)) File "/var/lib/python-support/python2.5/django/db/backends/util.py" in execute 19. return self.cursor.execute(sql, params) File "/var/lib/python-support/python2.5/django/db/backends/mysql/ base.py" in execute 84. return self.cursor.execute(query, args) File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in execute 168. if not self._defer_warnings: self._warning_check() File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in _warning_check 82. warn(w[-1], self.Warning, 3) File "/usr/lib/python2.5/warnings.py" in warn 62. globals) File "/usr/lib/python2.5/warnings.py" in warn_explicit 102. raise message Exception Type: Warning at /restaurant/add/ Exception Value: Truncated incorrect DOUBLE value: 'a'

    Read the article

  • The one true domain model - a fallacy?

    - by James L
    I've just finished working for a client which has burnt millions on a project to come up with the 'one true domain model' for their business. This was the project's sole deliverable. What are your thoughts on this? Is a single version of the truth realistic?

    Read the article

  • Store request.headers in a serialized model attribute

    - by Horace Loeb
    Here's my model: class Comment < ActiveRecord::Base serialize :request_headers end But when I try to do @comment.request_headers = request.headers I get a TypeError (can't dump anonymous class Class) exception. Another way to ask my question: how can I convert request.headers into a Hash? It uses a Hash under the covers so this should be easy, no?

    Read the article

  • Two Objects created with the same Address in Flex

    - by James
    Hi, I have an issue in flex which is causing a bit of a headache! I am adding objects to an ArrayCollection but in doing so, another ArrayCollection is also picking up these changes even though there is no binding occurring. I can see from the debug that the two ACs have the same address but for the life of me can't figure out why. I have two Array Collections: model.index.rows //The main array collection model.index.holdRows //The array collection that imitates the above This phantom data binding occurs only for the first iteration in the loop and for all others it will just write it the once. The reason this is proving troublesome is that it creates duplicate entries in my datagrid. public override function handleMessage(message:IMessage):void { super.handleMessage(message); if (message is IndexResponse) { var response:IndexResponse = message as IndexResponse; model.index.rows.removeAll(); model.index.indexIsEmpty = response.nullIndex; if (model.index.indexIsEmpty !== true) { //Update the index model from the response. Note: each property of the row object will be shown in the UI as a column in the grid response.index.forEach(function(entry:EntryData, i:int, a:Array):void { var row:Object = { fileID: entry.fileID, dadName: entry.dadName }; entry.tags.forEach(function(tag:Tag, i:int, a:Array):void { row[tag.name] = tag.value; }); model.index.rows.addItem(row); }); if(model.index.indexForNetworkView == true){ model.index.holdRows.source = model.index.holdRows.source.concat(model.index.rows.source); model.index.indexCounter++; model.index.indexForNetworkView = false; controller.indexController.showNetwork(model.index.indexCounter); } model.index.rows.refresh(); controller.networkController.show(); } } Has anyone else who has encountered something simillar propose a solution?

    Read the article

  • Is possible overwriting a Doctrine model in Symfony?

    - by user248959
    Hi, is possible overwriting a Doctrine model in Symfony? I'm trying no change a "notnull" property, but i can get it.. In 'plugins/sfDoctrineGuardPlugin/config/doctrine/schema.yml': sfGuardUser: actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true username: type: string(128) notnull: true unique: true #... And in 'config/doctrine/schema.yml': sfGuardUser: columns: username: type: string(128) notnull: false unique: true Then "build-all-reload" but it doesn't change.. Any idea? Javi

    Read the article

  • assign a model's attribute through association

    - by justcode
    I'm new to rails and working on a rails app and I'm stuck pondering this issue. I have three models class product < ActiveRecord::Base attr_accessible :name, :issn, :category validates_presence_of :name, :issn, :category validates_numericality_of :issn, :message => "has to be a number" has_many :user_products has_many :users, :through => :user_products end class UserProduct < ActiveRecord::Base attr_accessible :price, :category validates_presence_of :price, :category validates_numericality_of :price, :message = "has to be a number" belongs_to :user belongs_to :product end class user < ActiveRecord::Base # devise authentication here # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me has_many :user_products has_many :products, :through = :user_products end here is my new.html.erb <div class="MainBodyWrapper"> <div class="span8"> <div id="listBoxWrapper"> <fieldset> <%= form_for(@product, :html => { :class => "form-inline" }, :style => "margin-bottom: 60px" ) do |f| %> <div class="control-group"> <label class="control-label" for="name">name</label> <div class="controls"> <%= f.text_field :price, :class => 'input-xlarge input-name', :id => "name" %> </div> </div> <div class="listingButtons"> <button class="btn btn-info"></i>Add</button> <a class="btn">Upload Pictures (anytime)</a> </div> </fieldset> </div> </div> There are reasons why I want to setup the models this way. So the question is this: I want the user to enter the info for the product in the form but it also involves putting in the price of the product which exists in a different model/table (user_product) that is associated with product. How can I do this? You can see that my form_for uses @product. Any help will be appreciated.

    Read the article

  • Rails Plugin for Multiple Ratings Per Model?

    - by Kevin
    I'm looking to add the capability of rating a model I have under several different categories like "Knowledgeable" "Organized", etc. Is there a plugin that will allow me to do this, and maybe even have a cool x/5 stars graphical representation as well?

    Read the article

  • Override as_json or to_json model class name

    - by Jack
    I'd like to modify the classname when calling to_json on an AR model. i.e. Book.first.to_json #=> "{\"book\":{\"created_at\":\"2010-03-23 Book.first.to_json(:root => 'libro') #=> "{\"libro\":{\"created_at\":\"2010-03-23 Is there an option to do this?

    Read the article

  • Parameterized constructor in view model not working

    - by rajcool111
    I have one small issue. in my view model parameterized constructor is not working. while debugging i observed that default constructor get hit but it never triggers my parameterized constructor. How I can get my parameterized constructor working? public EmployeeRequestViewModel(IEventAggregator eventAggregator, IContextManager contextmanager):this() { _contextmanager = contextmanager; _eventAgg = eventAggregator; _eventAgg.GetEvent<EmployeeEvent>().Subscribe(EventTask); } public EmployeeRequestViewModel() { LoadEmpRequest(); }

    Read the article

  • How to apply query to model if field not filtered

    - by jdog
    I have a range of modules running on generator.yml. In some of those I would like to hide records by default of Status: CLOSED (being the last of a range of Statuses). OF course if the user filters for CLOSED i want to show these records. I thought it would make sense to apply andWhere('status_id=?',Status::CLOSED) in a specific table_method , but how do I access the filters of the module from within the model? Is there a better way to do this?

    Read the article

  • Validate dependent model validation and show error message.

    - by piemesons
    Just taking a simple example. We have a question on stackoverflow and while posting a question we want to validate title_of_question, description_of_question that they should be present. Now we have a another model tag having habtm relationshio with question model. How to validate that while saving the question. Means question must have some tags. here the code:-- Models:-- class Question < ActiveRecord::Base belongs_to :user has_and_belongs_to_many :tags has_many :comments, :as => :commentable has_many :answers, :dependent => :destroy validates_presence_of :title, :content, :user_id end class Tag < ActiveRecord::Base has_and_belongs_to_many :questions validates_presence_of :tag end Form for entering question and tag <div class="form"> <% form_for :question ,@question, :url => {:action => "create" } do |f| %> <fieldset> <%= f.error_messages %> <legend>Post a question</legend> <div> <%= f.label :title %>: <%= f.text_field :title, :size => 100 %> </div> <div> <%= f.label :content ,'Question' %>: <%= f.text_area :content, :rows => 10, :cols => 100 %> </div> <div> <%= label_tag 'tags' %>: <%= text_field_tag 'tag' ,'',:size=> 60 %> add multiple tag using comma </div> <div> <%= submit_tag "Post question" %> </div> </fieldset> <% end %> </div> From Controller.. (Right now question will be saved without validating tag) def create @question = Question.new(params[:question]) @question.user_id=session[:user_id] if @question.save flash[:notice] = "Question has been posted." redirect_to question_index_path else render :action => "new" end end questions_tags table has been created. One approach is creating a virtual column using attribute accessors. another approach is validate associated. right now assuming new tags can be created.(but not duplicate).

    Read the article

  • Advanced Model Binding vs 2010

    - by user281180
    Can I have an example of advanced model binding using ajaxpost? I have two classes Person and Test as follows: public class person{ public ArrayList Name = new ArrayList(); public Test []test {get;set;} } public class Test { public int ID{get;set;} public int mark{get;set;} } My Controller could be [HttpPost] public EmptyResult CaseTest(Person person) { return new EmptyResult(); } How do I post the values from the view?

    Read the article

  • Rails model without database

    - by FlipFlop
    I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What does the community recommend I do? Right now I am leaning toward coming up with my own solution based on this blog post.

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >