its almost what I wanted. One property (ex. length) has to have multiple values depending on the product you're looking at. a dropdown list of property names but then a value of the property that goes by this name for each product the property name is assigned to so basically on one card you create property names that are in a drop down list onthe product page and when you select a name a value box pops up to assign a value of the selected property that is specific to this product as many products (say of a similar type) might share the same properties.
On Sep 1, 10:41 pm, kevinpfromnm <[email protected]> wrote: > ok. what's the relationship between product and properties? > > I think the first part of what I posted before will work if it's a > many to many relationship. What you want, is the property value to be > on the join table (again, assuming I've got your intent) so: > > ProductProperty > fields do > value :integer # or whatever type you want > ... > end > belongs_to :product > belongs_to :property > > Product > has_many :product_properties, :accessible => true > has_many :properties, :through => :product_properties > > this will render on the product form, a multiple input for product > properties which will have a dropdown select for the property and an > input box for the value. > > On Sep 1, 2:04 pm, Scorpio <[email protected]> wrote: > > > I think there was a misunderstanding yet again. (I communicate with > > machines better it would seem) > > > the problem with the properties part of the page is not CSS its that > > the field inputs are of the wrong type and the merging of the product > > page and property value is not right. because what i'd like to see is > > [properties dropdown] and [(product specific )value input box] side by > > side and a get a sort of child view with the values instead (sort of > > like listing products and categories) where it says that this property > > has one value instead of showing it to me on the same page > > > On Sep 1, 9:31 pm, kevinpfromnm <[email protected]> wrote: > > > > ok, from that I got that product basically has and belongs to many (or > > > has_many through, same dif) products. on the product page, you can > > > create new properties which is not what you want. > > > > if that's right, you move your :accessible => true to the joining > > > model. > > > > Product > > > has_many :product_properties, :accessible => true > > > has_many :properties, :through => :product_properties > > > > Then, you're input-many will allow creation/deletion of > > > product_properties with a drop down for the belongs_to :property. > > > > On the css, I usually don't use cm or the like because it's hard to > > > mesh with the rest of the page. I like using em's for stuff that > > > should be sized relative to the text size and px for stuff that > > > shouldn't and then % when I just want to change it from default a bit > > > or to fit blocks etc. Basically, my css technique is trial and error > > > until it comes out how I want. :P > > > > On Sep 1, 11:07 am, Scorpio <[email protected]> wrote: > > > > > Sure I can. Here it goes: > > > > > that unique shorthand helped but the other problem that i was talking > > > > about is that on each product's card I get to create properties > > > > instead of selecting the ones that have been already created (I think > > > > i need to overwrite the form action - eureka! but i'm not sure how to > > > > merge it so i only replace the functionality thats wrong and not the > > > > whole page.) The problem with the properties and product specific > > > > values is that when I create say Hight and Width and set them to 10 > > > > and 20 cm accordingly i dont get a page that looks like > > > > *page content* > > > > > Properties > > > > --------- > > > > Hight :10 cm > > > > Width: 20 cm > > > > > Instead i get something like > > > > > Properties > > > > -------------- > > > > Hight > > > > has one value > > > > Width > > > > Has one value > > > > > And I need to click it to see that value. Its also messed up because i > > > > dont get the edit product page like > > > > [properties dropdown] [(product specific )value input box] [+] > > > > > i get something like > > > > > [properties input box] [+][-] > > > > value input box [+][-] > > > > > I can assign many values to the same property for one product and > > > > thats wrong. I need that but for separate products. Where did I mess > > > > up? > > > > > On Aug 30, 8:28 pm, kevinpfromnm <[email protected]> wrote: > > > > > > the multiple name issue what you want is a uniqueness validation. > > > > > hobo has a shortcut when you define the field, you can add :unique => > > > > > true and it adds a basic validates_uniqueness_of declaration for that > > > > > field. if you have more complicated uniqueness (i.e. name should be > > > > > unique for a given product_id but there can be more than one instance > > > > > of name in the same table), you'll need to use the standard rails > > > > > validation where you can add scope. > > > > > > I'm not quite sure what you're asking for the other part of your > > > > > question. can you perhaps clarify? > > > > > > On Aug 28, 3:46 pm, Scorpio <[email protected]> wrote: > > > > > > > I'm trying to tackle a rather interesting problem. > > > > > > > My setup: > > > > > > > model_resources: > > > > > > Product > > > > > > Property > > > > > > PropertyValue > > > > > > > associations: > > > > > > product has_many properties > > > > > > property has_many property_values > > > > > > (the rest is very fluid as I try for the 100th time) > > > > > > > I'm experimenting with joins to get the following end-result. > > > > > > On my Product card I want to display a list of properties that have > > > > > > been created and assign property values to them that are product- > > > > > > specific so that once a property has been selected it can have > > > > > > multiple values depending on the product. As far as displaying that > > > > > > goes I'd like to show it in the product card and only those sets of > > > > > > properties and values that have been assigned to that product with > > > > > > the > > > > > > ability to change the selected properties in that card (done) and > > > > > > edit > > > > > > in place the values on that same card > > > > > > > So far I managed to get all that in one view, add/remove properties > > > > > > and thats working fine but there are a few other problems. the > > > > > > properties and values are not unique (I can make 2 properties with > > > > > > the > > > > > > same name and I've got a create form not a select existing list) > > > > > > also > > > > > > the property values display as "has one property value" instead of > > > > > > say > > > > > > an editable form field with a value inside. > > > > > > > I'd gladly fix it myself but I have no idea how to bind values and > > > > > > properties on a product-specific level. > > > > > > Any pointer as to the order of tasks that need to be preformed to > > > > > > fix > > > > > > this would be great (I'm still somewhat new at rails and noob at > > > > > > hobo > > > > > > so I'm not sure how to do it exactly but once I have a list to guide > > > > > > me I should be able to slowly work my way through it). Any pointers > > > > > > on > > > > > > the harder parts would be great tho :) > > > > > > > Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
