Search Results

Search found 25123 results on 1005 pages for 'domain model'.

Page 168/1005 | < Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >

  • Extract domain from body of email

    - by iman453
    Hi, I was wondering if there is any way I could extract domain names from the body of email messages in python. I was thinking of using regular expressions, but I am not too great in writing them, and was wondering if someone could help me out. Here's a sample email body: <tr><td colspan="5"><font face="verdana" size="4" color="#999999"><b>Resource Links - </b></font><span class="snv"><a href="http://clk.about.com/?zi=4/RZ">Get Listed Here</a></span></td><td class="snv" valign="bottom" align="right"><a href="http://sprinks.about.com/faq/index.htm">What Is This?</a></td></tr><tr><td colspan="6" bgcolor="#999999"><img height="1" width="1"></td></tr><tr><td colspan="6"><map name="sgmap"><area href="http://x.about.com/sg/r/3412.htm?p=0&amp;ref=fooddrinksl_sg" shape="rect" coords="0, 0, 600, 20"><area href="http://x.about.com/sg/r/3412.htm?p=1&amp;ref=fooddrinksl_sg" shape="rect" coords="0, 55, 600, 75"><area href="http://x.about.com/sg/r/3412.htm?p=2&amp;ref=fooddrinksl_sg" shape="rect" coords="0, 110, 600, 130"></map><img border="0" src="http://z.about.com/sg/sg.gif?cuni=3412" usemap="#sgmap" width="600" height="160"></td></tr><tr><td colspan="6">&nbsp;</td></tr> <tr><td colspan="6"><a name="d"><font face="verdana" size="4" color="#cc0000"><b>Top Picks - </b></font></a><a href="http://slclk.about.com/?zi=1/BAO" class="srvb">Fun Gift Ideas</a><span class="snv"> from your <a href="http://chinesefood.about.com">Chinese Cuisine</a> Guide</span></td></tr><tr><td colspan="6" bgcolor="cc0000"><img height="1" width="1"></td></tr><tr><td colspan="6" class="snv"> So I would need "clk.about.com" etc. Thanks!

    Read the article

  • How to model has_many with polymorphism?

    - by Daniel Abrahamsson
    I've run into a situation that I am not quite sure how to model. Suppose I have a User class, and a user has many services. However, these services are quite different, for example a MailService and a BackupService, so single table inheritance won't do. Instead, I am thinking of using polymorphic associations together with an abstract base class: class User < ActiveRecord::Base has_many :services end class Service < ActiveRecord::Base validates_presence_of :user_id, :implementation_id, :implementation_type belongs_to :user belongs_to :implementation, :polymorphic = true delegate :common_service_method, :name, :to => :implementation end #Base class for service implementations class ServiceImplementation < ActiveRecord::Base validates_presence_of :user_id, :on => :create has_one :service, :as => :implementation has_one :user, :through => :service after_create :create_service_record #Tell Rails this class does not use a table. def self.abstract_class? true end #Default name implementation. def name self.class.name end protected #Sets up a service object def create_service_record service = Service.new(:user_id => user_id) service.implementation = self service.save! end end class MailService < ServiceImplementation #validations, etc... def common_service_method puts "MailService implementation of common service method" end end #Example usage MailService.create(..., :user_id => user.id) BackupService.create(...., :user_id => user.id) user.services.each do |s| puts "#{user.name} is using #{s.name}" end #Daniel is using MailService, Daniel is using BackupService So, is this the best solution? Or even a good one? How have you solved this kind of problem?

    Read the article

  • Use interface between model and view in ASP.NET MVC

    - by Icerman
    Hi, I am using asp.net MVC 2 to develop a site. IUser is used to be the interface between model and view for better separation of concern. However, things turn to a little messy here. In the controller that handles user sign on: I have the following: IUserBll userBll = new UserBll(); IUser newUser = new User(); newUser.Username = answers[0].ToString(); newUser.Email = answers[1].ToString(); userBll.AddUser(newUser); The User class is defined in web project as a concrete class implementing IUser. There is a similar class in DAL implementing the same interface and used to persist data. However, when the userBll.AddUser is called, the newUser of type User can't be casted to the DAL User class even though both Users class implementing the interface (InvalidCastException). Using conversion operators maybe an option, but it will make the dependency between DAL and web which is against the initial goal of using interface. Any suggestions?

    Read the article

  • How to model a mutually exclusive relationship in sql server

    - by littlechris
    Hi, I have to add functionality to an existing application and I've run into a data situation that I'm not sure how to model. I am being restricted to the creation of new tables and code. If I need to alter the existing structure I think my client may reject the proposal..although if its the only way to get it right this is what I will have to do. I have an Item table that can me link to any number of tables, and these tables may increase over time. The Item can only me linked to one other table, but the record in the other table may have many items linked to it. Examples of the tables/entities being linked to are "Person", "Vehicle", "Building", "Office". These are all separate tables. Example of Items are "Pen", "Stapler", "Cushion", "Tyre", "A4 Paper", "Plastic Bag", "Poster", "Decoration" For instance a "Poster" may be allocated to a "Person" or "Office" or "Building". In the future if they add a "Conference Room" table it may also be added to that. My intital thoughts are: Item { ID, Name } LinkedItem { ItemID, LinkedToTableName, LinkedToID } The LinkedToTableName field will then allow me to identify the correct table to link to in my code. I'm not overly happy with this solution, but I can't quite think of anything else. Please help! :) Thanks!

    Read the article

  • Fluent NHibernate - Delete a related object when no explicit relationship exists in the model

    - by John Price
    I've got an application that keeps track of (for the sake of an example) what drinks are available at a given restaurant. My domain model looks like: class Restaurant { public IEnumerable<RestaurantDrink> GetRestaurantDrinks() { ... } //other various properties } class RestaurantDrink { public Restaurant Restaurant { get; set; } public Drink { get; set; } public string DrinkVariety { get; set; } //"fountain drink", "bottled", etc. //other various properties } class Drink { public string Name { get; set; } public string Manufacturer { get; set; } //other various properties } My db schema is (I hope) about what you'd expect; "RestaurantDrinks" is essentially a mapping table between Restaurants and Drinks with some extra properties (like "DrinkVariety" tacked on). Using Fluent NHibernate to set up mappings, I've set up a "HasMany" relationship from Restaurants to RestaurantDrinks that causes the latter to be deleted when its parent Restaurant is deleted. My question is, given that "Drink" does not have any property on it that explicitly references RestaurantDrinks (the relationship only exists in the underlying database), can I set up a mapping that will cause RestaurantDrinks to be deleted if their associated Drink is deleted?

    Read the article

  • Reading only one row from table in model binder

    - by user281180
    I am filling a table dynamically. I can see the table filled with 3 rows, but in my model binder I can read only one value. How can I solve this problem? My code is as follows: function AddTableRow(jQtable, value, text){ var count = 0; jQtable.each(function() { var $table = $(this); var tds = '<tr>'; tds += '<td>' + '<input type="text" value = ' + text + ' disabled ="disabled" style="width:auto"/>' + '<input type="hidden" name="projectList[' + count + '].ID" value = ' + value + ' /></td>' + '<td><input type="button" value="Remove"/></td>'; tds += '</tr>'; if ($('tbody', this).length > 0) { $('tbody', this).append(tds); } else { $(this).append(tds); } count++;}); } function ReadSelectedProject() { $("#Selected option").each(function() { AddTableRow($('#projectTable'), $(this).val(), $(this).text()); }); }

    Read the article

  • nginx multiple domain virtual host configuration

    - by Poe
    I'm setting up nginx with multiple domain or wildcard support for convenience sake, rather than setting up 50+ different sites-available/* files. Hopefully this is enough to show you what I'm trying to do. Some are static sites, some are dynamic with usually wordpress installed. If an index.php exists, everything works as expected. If a file is requested that does not exist (missing.html), a 500 error is given due to the rewrite. The logged error is: *112 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/missing.html" The basic nginx configuration I'm currently using is: ` listen 80 default; server _; ... location / { root /var/www/$host; if (-f $request_filename) { expires max; break; } # problem, what if index.php does not exist? if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } } ... ` If an index.php does not exist, and the file also does not exist, I would like it to error 404. Currently, nginx does not support multiple condition if's or nested if so I need a workaround.

    Read the article

  • Best practice to test a web application, regarding domain name and integration with external service

    - by ycseattle
    I have run into these problems several times and was never able to find a comfortable solution. Let's say my website has the domain name MyDomain.com. When I run the tests on the test machine (a continuous integration server), I will modify the HOSTS file on this machine so the MyDomain.com is mapped to this local machine instead of the real production server. This doesn't work very well for many situations. For example, my application will create subdomain names user1.MyDomain.com dynamically but this is difficult to keep the testing flexible. Another problem is my web application will interact with Amazon S3, and sometimes other service like Amazon Simple Message Queue. I am only comfortable to include these interaction in my tests but I am never happy with my solution for mixing testing and production on Amazon services. Could somebody offer some tips on these issues? I would like to make my testing framework clean and flexible. I am sure this is a common question for all web applications and there must be a mature way to deal with these. Thanks!

    Read the article

  • Only show non blank attributes for a model in views in Rails

    - by Senthil
    Say I've a user model and there are bunch of user info, like email, birthdate, location, telephone number etc. What's the simplest way of hiding the attributes that are blank? I've doing something like <% if blog.title.empty? -%> <p>Body: <%=h blog.body %></p> <p>Comments: <%=h blog.comments %></p> <% elsif blog.body.empty? %> <p>Title: <%=h blog.title %></p> <p>Comments: <%=h blog.comments %></p> <% else -%> <p>Title: <%=h blog.title %></p> <p>Body: <%=h blog.body %></p> <% end -%> Clearly that is one ugly child. Other than using partials to render, is there a trick to only show non blank fields? I've been trying to write a helpher method to make the view cleaner, but that's even more ugly. Any help is appreciated.

    Read the article

  • Populate an unmapped property of domain object from result of join with Nhibernate

    - by Adam Pope
    I have a situation where I have 3 tables: StockItem, Office and StockItemPrice. The price for each StockItem can be different for each Office. StockItem( ID Name ) Office( ID Name ) StockItemPrice( ID StockItemID OfficeID Price ) I've set up a schema with 2 many-to-one relations to link StockItem and Office. So in my StockItem domain object I have a property: IList<StockItemPrice> Prices; which gets loaded with the price of the item for each office. That's working fine. Now I'm trying to get the price of an item for a single office. I have the following Criteria query: NHibernateSession.CreateCriteria(persistentType) .Add(Restrictions.Eq("ID", id)) .CreateAlias("Prices", "StockItemPrice") .Add(Restrictions.Eq("StockItemPrice.Office", office)) .UniqueResult<StockItem>(); This appears to work fine as the SQL it generates is what I qould expect. However, I dont know if it populates StockItem.Prices with a single object correctly as as soon as I reference that property NHibernate performs a lazy load of all the office's prices. Also, even if it does work, it feels really crufty having to access the price by using: mystockitem.Prices[0].Price What I would really like is to have a Price field on the StockItem object and have the price of the item put into that field by NHibernate. I've tried adding .CreateCriteria("Price", "StockItemPrice.Price") and the same with CreateAlias, but I get the error NHibernate.QueryException : could not resolve property: Price of: StockItem which makes sense I guess as Price isn't a mapped property. How would I adjust the query to make this possible?

    Read the article

  • WCF: Exposed Object Model - stuck in a loop

    - by Mark
    Hi I'm working on a pretty big WSSF project. I have a normal object model in the business layer. Eg a customer has an orders collection property, when this is accessed then it loads from the data layer (lazy loading). An order has a productCollection property etc etc.. Now the bit I'm finding tricky is exposing this via WCF. I want to export a collection of orders. The client app will also need information about the customers. Using the WSSF data contract designer I have set it up so that customers have a property called "order collection". This is fine if you have a customer object and would like to look at the orders but if you have an order object there is no customer property so it doesn't work going up the hierarchy. I've tried adding a customer property to the orders object but then the code gets stuck in a loop when it loads the data contracts up. This is because it doesn't load on demand like in the business layer. I need to load all properties up before the objects can be sent out via WCF. It ends up loading an order, then the customer for that order, then the orders for that customer, then the customer for that order etc etc... I'm sure I've got all this wrong. Help!!

    Read the article

  • Running a Model::find in for loop in cakephp v1.3

    - by Gaurav Sharma
    Hi all, How can I achieve the following result in cakephp: In my application a Topic is related to category, category is related to city and city is finally related to state in other words: topic belongs to category, category belongs to city , city belongs to state.. Now in the Topic controller's index action I want to find out all the topics and it's city and state. How can I do this. I can easily do this using a custom query ($this-Model-query() function ) but then I will be facing pagination difficulties. I tried doing like this function index() { $this->Topic->recursive = 0; $topics = $this->paginate(); for($i=0; $i<count($topics);$i++) { $topics[$i]['City'] = $this->Topic->Category->City->find('all', array('conditions' => array('City.id' => $topics[$i]['Category']['city_id']))); } $this->set(compact('messages')); } The method that I have adopted is not a good one (running query in a loop) Using the recursive property and setting it to highest value (2) will degrade performance and is not going to yield me state information. How shall I solve this ? Please help Thanks

    Read the article

  • Appengine JDO dataclasses to python model

    - by M.A. Cape
    Does anyone have tried to implement an app in GAE having both java and python? I have an existing app and my front end is in java. Now I want to use the existing datastore to be interfaced by python. My problem is i don't know how to define the relationships and model that would be equivalent to the one in java. I have tried the one-to-many relationship in python but when stored in the datastore, the fields are different than the one-to-many of java. My data classes are as follows. //one-to-many owned Parent Class public class Parent{ @PrimaryKey @Persistent private String unitID; //some other fields... @Persistent @Order(extensions = @Extension(vendorName="datanucleus", key="list-ordering", value="dateCreated desc")) private List <Child> child; //methods & constructors were omitted } Child public class Child{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key uId; @Persistent private String name; /* etc... */ }

    Read the article

  • Creating a complex tree model in Qt

    - by Zeke
    I'm writing an IRC Client (yes another one). Long story short. I'm writing a Server dialogue that keeps a list of this: Identity Networks Channels Addresses I have 3 different list views that will be for the Networks, Channels and Addresses. When the user changes the Identity (combo box). The network listview will lookup all the networks for that specific Identity. After it loads up the Networks it will automatically select the first network and then load all the channels and addresses for that specific network. The problem is I want to have 3 views for 1 model, to minimise all the memory and the loading of data. So that it makes it much easier to manage and not do a bunch of work. If you'd look at QColumnView it's the same exact thing. But I don't need it to be on one exact page since the views are on entirely different tabs to make it easier to go through the Server dialogue. I'm wondering what will be the best way to go about handling this complexity. The information is stored in a SQLite database. I already have the classes written to extract and store it. Just the modelling is the painful part of this solution.

    Read the article

  • Connect Rails model to non-rails database

    - by the_snitch
    I'm creating a new web application (Rails 3 beta), of which pieces of it will access data from a legacy mysql database that a current php application is using. I do not wish to modify the legacy db schema, I just want to be able to read/write to it, as well as the rails application having it's own database using activerecord for the newer stuff. I'm using mysql for the rails app, so I have the adapter installed. How is the best way to do this? For example, I want contacts to come from the old database. Should I create a contacts controller, and manually call sql to get the variables for the views? Or should I create a Contact model, and define attributes that match the fields in the database, and am I able to use it like Contact.mail_address to have it call "SELECT mailaddr FROM contacts WHERE id=Contact.id". Sorry, I've never done much in Rails outside of the standard stuff that is documented well. I'm not sure of what the best approach would be. Ideally, I want the contacts to be presented to my rails application as native as possible, so that I can expose them RESTfully for API access. Any suggestions and code examples would be much appreciated

    Read the article

  • Fastest way to perform subset test operation on a large collection of sets with same domain

    - by niktech
    Assume we have trillions of sets stored somewhere. The domain for each of these sets is the same. It is also finite and discrete. So each set may be stored as a bit field (eg: 0000100111...) of a relatively short length (eg: 1024). That is, bit X in the bitfield indicates whether item X (of 1024 possible items) is included in the given set or not. Now, I want to devise a storage structure and an algorithm to efficiently answer the query: what sets in the data store have set Y as a subset. Set Y itself is not present in the data store and is specified at run time. Now the simplest way to solve this would be to AND the bitfield for set Y with bit fields of every set in the data store one by one, picking the ones whose AND result matches Y's bitfield. How can I speed this up? Is there a tree structure (index) or some smart algorithm that would allow me to perform this query without having to AND every stored set's bitfield? Are there databases that already support such operations on large collections of sets?

    Read the article

  • After update hook not being called for DataMapper model with dm 1.0.2

    - by Macario
    Hi, I've the following model and I want to execute a method on save and update, problem is that the hook is not being executed on update. class User include DataMapper::Resource include BCrypt property :id, Serial property :email, String, :index => true property :crypted_password, String, :accessor => :private ... attr_accessor :password, :password_confirmation before :save, :encrypt_password! # also tried the following with no success: # before :update, :encrypt_password! # and tried this but hell was never raised # before :update do # raise 'hell' # end def encrypt_password! self.crypted_password = Password.create password end end This spec fails: it 'should call encrypt_password! on update' do subject.save.should be_true subject.should_receive(:encrypt_password!) subject.update(:password => 'other-password', :password_confirmation => 'other-password').should be_true end And this passes: it 'should call encrypt_password! on create' do subject.should_receive(:encrypt_password!) subject.save.should be_true end I've also tried with after :update in addition to after :save with no success. Am I missing something?

    Read the article

  • Grails GORM rarely works in domain classes

    - by Vena
    I have many to many relationship between User and Organization. I want to delete user from all his organizations when the user is being deleted, so this is basically what I came up with: class User { ... def beforeDelete() { def user = User.get(id) Organization.all.each { it.removeFromMembers(user) it.save() } } } This surprisingly doesn't work because User.get(id) returns null even though the user with the given id is in the database, when I look at the log, no sql statement is even executed. So I tried to use load() method insted. ObjectNotFoundException is the result then. So I tried this as I was quite desperate: def user = User.find("from User as u where u.id = ?", [1L]) This, for some reason, works. But now, the line with it.removeFromMembers(user) throws NullPointerException. I tried to put this logic in my UserController and it works! Why is this? Why can't I do this in domain classes? This makes beforeDelete hook (and all the others too) pretty useless.

    Read the article

  • Using nHibernate to map two different data models to one entity model

    - by Dan
    I have two different data models that map to the same Car entity. I needed to create a second entity called ParkedCar, which is identical to Car (and therefore inherits from it) in order to stop nhibernate complaining that two mappings exists for the same entity. public class Car { protected Car() { IsParked = false; } public virtual int Id { get; set; } public bool IsParked { get; internal set; } } public class ParkedCar : Car { public ParkedCar() { IsParked = true; } //no additional properties to car, merely exists to support mapping and signify the car is parked } The only issue is that when I come to retrieve a Car from the database using the Criteria API like so: SessionProvider.OpenSession.Session.CreateCriteria<Car>() .Add(Restrictions.Eq("Id", 123)) .List<Car>(); The query brings back Car Entities that are from the ParkedCar data model. Its as if nhibernate defaults to the specialised entity. And the mappings are defiantly looking in the right place: <class name="Car" xmlns="urn:nhibernate-mapping-2.2" table="tblCar"> <class name="ParkedCar" xmlns="urn:nhibernate-mapping-2.2" table="tblParkedCar" > How do I stop this?

    Read the article

  • Issue with class design to model user preferences for different classes

    - by Mulone
    Hi all, I'm not sure how to design a couple of classes in my app. Basically that's a situation: each user can have many preferences each preference can be referred to an object of different classes (e.g. album, film, book etc) the preference is expressed as a set of values (e.g. score, etc). The problem is that many users can have preferences on the same objects, e.g.: John: score=5 for filmid=apocalypsenow Paul: score=3 for filmid=apocalypsenow And naturally I don't want to duplicate the object film in each user. So I could create a class called "preference" holding a score and then a target object, something like: User{ hasMany preferences } Preference{ belongsTo User double score Film target Album target //etc } and then define just one target. Then I would create an interface for the target Classes (album, film etc): Interface canBePreferred{ hasMany preferences } And implement all of those classes. This could work, but it looks pretty ugly and it would requires a lot of joins to work. Do you have some patterns I could use to model this nicely? Cheers, Mulone

    Read the article

  • association of more than one model to a listview

    - by Veer
    I have 3 Tables in my database. Each table has 3 fields each, excluding the ID field. out of which 2 fields are of type nvarchar. None of the tables are related. My ListView in the application helps the user to search my database, the search being incremental. The search includes the nvarchar fields of the 3 tables ie, 6 fields in total. Eg: PhoneBook: Name, PhoneNo Notes: Title, Content Bookmarks: Name, url I've the models generated for the 3 tables. Now the ListBox should display the Ph.Name, Title and the Bo.Name fields. ie, It should be bound to them. But they are from different models. I also should be able to perform CRUD operation on the item searched. How would i do that? P.S: Separate ViewModels are created for each Model which are used for their respective views for handling those tables individually. But this is an integrated view where the user should be able to search everything. Also please somebody suggest me a better Title for this question:)

    Read the article

  • Beginner Question on traversing a EF4 model

    - by user564577
    I have a basic EF4 model with two entities. I'm using Self Tracking Entities Client has ClientAddresses relationship on clientkey = clientkey. (1 to many) How do i get a list/collection of client entities (STE) and their addresses (STE) but only ones where they live in a particular state or some such filter on the address??? This seems to filter and bring back clients but doesnt bring back addresses. var j = from client in context.Clients where client.ClientAddresses.All(c => c.ZIP == "80923") select client; I cant get this to create the Addresses because ClientAddresses is IEnumerable and it needs a TrackableCollection var query = from t1 in context.Clients join t2 in context.ClientAddresses on t1.ClientKey equals t2.ClientKey where t2.ZIP == "80923" select new Client { FirstName = t1.FirstName, LastName = t1.LastName, IsEnabled = t1.IsEnabled, ClientKey = t1.ClientKey, ChangeUser = t1.ChangeUser, ChangeDate = t1.ChangeDate, ClientAddresses = from a in t1.ClientAddresses select new ClientAddress { AddressKey = a.AddressKey, AddressLine1 = a.AddressLine1, AddressLine2 = a.AddressLine2, AddressTypeCode = a.AddressTypeCode, City = a.City, ClientKey = a.ClientKey, State = a.State, ZIP = a.ZIP } }; Any pointers would be appreciated. Thanks Edit: This seems to work.... var j = from client in context.Clients.Include("ClientAddresses") where client.ClientAddresses.Any(c => c.ZIP == "80923") select client;

    Read the article

  • Manually wiring up unobtrusive jquery validation client-side without Model/Data Annotations, MVC3

    - by cmorganmcp
    After searching and experimenting for 2 days I relent. What I'd like to do is manually wire up injected html with jquery validation. I'm getting a simple string array back from the server and creating a select with the strings as options. The static fields on the form are validating fine. I've been trying the following: var dates = $("<select id='ShiftDate' data-val='true' data-val-required='Please select a date'>"); dates.append("<option value=''>-Select a Date-</option>"); for (var i = 0; i < data.length; i++) { dates.append("<option value='" + data[i] + "'>" + data[i] + "</option>"); } $("fieldset", addShift).append($("<p>").append("<label for='ShiftDate'>Shift Date</label>\r").append(dates).append("<span class='field-validation-valid' data-valmsg-for='ShiftDate' data-valmsg-replace='true'></span>")); // I tried the code below as well instead of adding the data-val attributes and span manually with no luck dates.rules("add", { required: true, messages: { required: "Please select a date" } }); // Thought this would do it when I came across several posts but it didn't $.validator.unobtrusive.parse(dates.closest("form")); I know I could create a view model ,decorate it with a required attribute, create a SelectList server-side and send that, but it's more of a "how would I do this" situation now. Can anyone shed light on why the above code wouldn't work as I expect? -chad

    Read the article

  • Generating jquery 'rules' from business model to UI in asp.net mvc

    - by jim
    Hi all, I've had a good look around and am certain that there's no matching question on SO, so here goes. Has anyone created a 'helper' method on their model that generates jquery (or plain javascript) rules validation dynamically, based on the criteria/rules that are contained within the object and taken from a repository (i.e. DB). What i'm thinking of is a discrete set of partial views (and associated models) that have rules at the business logic 'level' and rather than (or in combination with) validating the rule(s) at postback, translating the same rules into tightly focussed jquery methods that work identically at client (js) and server (c#) levels. I can see benefits here re performance. Also, the rules definitions could be created in a single place (in c#) and the jquery generated off of that, thus allowing single edits to update both code streams. I appreciate that there would be limitations imposed by language specific contstraints but the general principle could be quite interesting if used appropriately. I'm also aware that testibility could be an issue when using two different language structures and hoping to achieve similar test outcomes - but those aside... any thoughts or experiences of similar out there?? cheers jimi

    Read the article

  • Nested model form with collection in Rails 2.3

    - by kristian nissen
    How can I make this work in Rails 2.3? class Magazine < ActiveRecord::Base has_many :magazinepages end class Magazinepage < ActiveRecord::Base belongs_to :magazine end and then in the controller: def new @magazine = Magazine.new @magazinepages = @magazine.magazinepages.build end and then the form: <% form_for(@magazine) do |f| %> <%= error_messages_for :magazine %> <%= error_messages_for :magazinepages %> <fieldset> <legend><%= t('new_magazine') %></legend> <p> <%= f.label :title %> <%= f.text_field :title %> </p> <fieldset> <legend><%= t('new_magazine_pages') %> <% f.fields_for :magazinepages do |p| %> <p> <%= p.label :name %> <%= p.text_field :name %> </p> <p> <%= p.file_field :filepath %> </p> <% end %> </fieldset> <p> <%= f.submit :save %> </p> </fieldset> <% end %> problem is, if I want to submit a collection of magazinepages, activerecord complaints because it's expected a model and not an array. create action: def create @magazine = Magazine.new params[:magazine] @magazine.save ? redirect_to(@magazine) : render(:action => 'new') end

    Read the article

< Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >