similar to: Updateform with a has_many relationship ?

Displaying 20 results from an estimated 500 matches similar to: "Updateform with a has_many relationship ?"

2006 Apr 20
2
Globalize : how to detect if a translated text is available ?
Hi all, I was wondering how one can detect if a translated text is available when using the globalize plugin. If this is possible , then I would like to make the following : For example, in your view you have : <%@menu.each { | item | %> <%=item.t%> <%}%> Now what I would like to happen is , when the menu item has no translation available , and when a admin is logged in
2006 Apr 18
2
Implementing Globalize
Hello all, I was wondering if any of you know some good documentation that points out how to implement the Globalization plugin in your existing application. Also some text on how to use a cms like system with Globalization (how to handle the population of the translated texts per item for example) With kind regards, Gerard de Brieder. Govannon. tel : +31624739047
2006 Mar 13
8
Nested find(:all, :include => ) statements
Is there a way for me to do: OrderItem.find(:all, :include => [:user, :product => [:supplier]] So I don''t have a supplier_id on my order_item, but have it on my product, which is part of order_item. Joerg -- Posted via http://www.ruby-forum.com/.
2006 Jul 06
7
form_remote_tag submitting to an rjs file.
I have the following form that I am trying to use, but for some reason, the form gets submitted with out the params values. <%= form_remote_tag(:url => { :action => :add_item_to_order }) %> <tr> <td> <%=collection_select(:order_item , :item_category_id, @item_categories, :id, :name)%> </td> <td> <%= text_field
2006 Mar 14
5
GROUP BY and SUM
I have orders, order_items, and products. I want to collate several orders so that I can get a SUM of quantities ordered for each product etc. Can I say something like (the below gives an error on :sum, and ignores :group) OrderItem.find(:all, :sum => ''quantity'', :group => ''product_id'', :include => [:order, :product]) I want to get back a
2005 Dec 30
2
newbie
Hello There I new to rails development and looking to write a simple site using rails. Does any one know of and example ecommerce application that that I can use as a base to build from. My db schema is very simple--product, categories, orders and order_item tables. Any suggestions will be highly appreciate. Thanks Pat
2007 Oct 13
4
Chapter 9
Hello, I''m currently stunk on this issue for few days and I do not know how to get it fixed. The system always raises this error message : order is closed and here is my order.rb: class Order < ActiveRecord::Base include ActiveMerchant::Billing before_validation :set_status attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at attr_accessor
2006 Jul 11
0
using acts_as_list storing the information in a session
Hi, I have an order model that i am storing in a session, that is not currently in the database. I am updating the page using ajax, and I do not want to store the order in the database untill it is completely filled out. I have order_items that I am adding to the order, and I have used the acts_as_list within the order_item model. My problem comes when i try and rearrange the order_items
2006 Apr 20
2
Additional Fields in a Join Table
Hi, I am creating an order management web application, and have run into an issue over join tables. I am reading Agile Web Development and it says that I can put additional fields within my join tables, and they give the example of a date field. I want to know if it is possible to do the following: I have an orders table with the order information as well as an orders_items table and an
2006 Mar 09
1
[TIP] Making an intelligent form fields
After searching arround I found a quite smart solution to me for binding form fields to model in an active way. I use aggregations with single value objects such as class Percentage attr_accessor :value def initialize(value) @value = (value.is_a? String) ? value.tr('' %'', '''').to_f : value end def to_s return unless value
2006 May 28
0
expanding details examples?
I''m currently using page.visual_effect :toggle_appear to toggle the appearance of details associated with an order. As I am inserting the detail data prior to making it visible, this method is not appropriate (it also loads the data on hide). I was thinking I could change the hide/show href each time it is clicked, or even store a value on the page and toggle it each time
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m getting this error: "undefined method `product'' for #<BigDecimal:331ce70,''0.21E1'',8(8)> " "Extracted source (around line #9): 8: for item in @items 9: product = item.product 10: -%> 11: <tr> 12: <td><%= item.product%></td>"
2006 Jan 31
2
asigning values to atributies when source is nil
I want to use something similar to the following: @total_price += { product.price <> nil ? product.price : 0.0 } This fails in rails with a "nil can''t be coerced into Float" error. What is the (most) correct way to do this? On a related issue, what is the significance of the value 40 following "cart.rb" in the trace snippet below? The entire class file
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture- driven way of spec-ing or mocking. How the heck to you mock this so the code at line (2) and (4) work right? I''m still struggling with mocks but it seems like this can be done. Forgive the naivety of this question. 1. def change_quantity 2. @line_item = LineItem.find_by_id(params[:id]) 3. unless
2006 Sep 08
1
testing question
ok, i''ve written a couple of unit tests and it was pretty straight forward as far as what i should and shouldn''t be testing in the unit test.. until now. i am testing a customer model right now.. i figure that a unit test should test the functions of a model as well as if you can do all the crud stuff and validations. right now i wish to test a customer model function that
2006 Aug 15
3
update or alter cart
I want to modify and update the items in the Depot - "display_cart". Since the cart is in a session, its a little hard to get at the data. I just want to create a way to change quantities, prices and recalculate. Has someone done this, and could you point me to the right direction. Thanks Chas -- Posted via http://www.ruby-forum.com/.
2006 Feb 27
2
Find not working
Hello all. I have the following code (taken from the depot tutorial then modified) def add_dish( dish, type, qnty ) item = @items.find {|i| i.dish_id == dish.id && i.type == type } if item item.quantity += qnty.to_i else if type == ''Fresh'' item = Fresh.for_dish(dish) else item = Frozen.for_dish(dish) end
2006 May 26
4
Using ''validates_inclusion_of'' to validate foreign key
I seem to be missing something trying to use ''validates_inclusion_of'' to validate a foreign key and was hoping some one could piont out my mistake? The problem seems to be that Order.find_all.collect is not returning an array that contains the order_id, if I replace it with a hardcoded array everything works as expected. The model: class OrderItem < ActiveRecord::Base
2006 Mar 05
3
"Undefined method" problem in "Agile Web Development With Rails"
Hi, I''m reading the "Agile Web Development With Rails" book. So long, everything has worked fine, but now I got this annoying error message that I just can''t understand. The error appears for me around page 87, chapter 8. NoMethodError in Store#display_cart Showing app/views/store/display_cart.rhtml where line #28 raised: undefined method `product''
2007 Oct 19
14
Agile Web Development Book, need a bit of help
I''m working my way through the book Agile Web Development with Rails, and I am in the section where the book has me creating a display_cart method and the associated view. When I copied the code from the book into the view, it threw this error. If anyone could give me some hints where I should be looking I''d appreciate it. NoMethodError in Store#display_cart Showing