similar to: Chapter 9

Displaying 18 results from an estimated 18 matches similar to: "Chapter 9"

2007 May 30
9
Specify attr_protected
This is kind of a two part question. Question One: I want to be sure that an Order model is protecting sensitive attributes from mass assignment. The example looks like this: describe Order do it "should protect total attribute from mass assignment" do @order = Order.new(:total => 0.05) @order.total.should_not == 0.05 end end And the code to implement it: class Order
2008 Feb 20
1
link_to weirdness, related to namespace?
Hi, In my app/views/admin/clieint/_searchresults.rhtml partial, I have ... <% for user in @users %> <tr> <td><%=h user.ship_to_first_name %></td> <td><%=h user.ship_to_last_name %></td> <td><%=h user.email %></td> <td align="center"><%= link_to ''Show'', {:action =>
2009 Oct 07
1
output validations errors form causing type error?
Hi, I was wondering if it is possible to output validation errors in a nested form? I suppose this should be possible, but I am experiencing an error message that I can''t track down. The error I get is the following : TypeError in Store/orders#create Showing app/views/store/orders/new.html.erb where line #45 raised: can''t convert Array into String This is ocurring in the
2008 Feb 28
2
random exception driving me crazy: SecurityError (Insecure: can't modify array)
Hi all, I''m running into a very strange but incredibly annoying problem that I just can''t seem to solve. The exception is occurring from a seemingly innocuous line in my code, a simple ''logger.warn("some debug information")''. The backtrace follows: SecurityError (Insecure: can''t modify array)
2010 Mar 22
2
ActiveMerchant, Authorize.net and Email Receipts
I''ve posted this on RailsForum.com and in the ActiveMerchant talk group, and haven''t received an answer, so I figure I''ll try here. Hello. I''ve been searching for information on this for a while, but my google fu is evidently weak--hardly anyone even talks about email receipts re: ActiveMerchant, much less my specific problem. In any case, I have a client whose
2008 Aug 24
2
config.after_initialize and development mode
Hi, I''m using activemerchant and setting up a class variable using config.after_initialize. It works great for the first request, but then the variable is nil. config.after_initialize do ActiveMerchant::Billing::Base.mode = :test OrderTransaction.gateway = ActiveMerchant::Billing::PaypalGateway.new(...) end I''m assuming this is is due to the model reloading after each
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
2006 Dec 02
0
Fwd: Re: Mocha and ActiveRecord
---------- Forwarded message ---------- From: J. B. Rainsberger <jbrains762 at gmail.com> Date: 02-Dec-2006 02:48 Subject: Re: Mocha and ActiveRecord To: ruby-talk ML <ruby-talk at ruby-lang.org> James Mead wrote: > On 28/11/06, J. B. Rainsberger <jbrains762 at gmail.com> wrote: >> >> Suppose I have an Order, which has_many OrderItems. Suppose I want to >>
2006 Feb 20
0
YAML and has many associations
Hi, I have the following: order = YAML::load(order_yaml) The YAML contains order_items too, and my order model has a has_many to order_items. When I do order.order_items, I don''t want Rails to go the db to get the order_items, but use the order_items already contained in the object created from the YAML. How would I do this? Thanks Joerg -- Posted via
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 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 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 Apr 14
3
Updateform with a has_many relationship ?
Hello all, I would like to be able to update the "amount" of a certain item in me order list. The problem I run into is how to define the text_field element. @order is the current order, which has_many :order_item which in turn belongs_to :order. order_item has a field "amount" which should be modified... What I tried is this below, but I get a undefined method
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
2006 Jul 23
7
"throwing out the old": does Rails really not support...
Frankly I''m losing tolerance for the MS "stack." And I''m intrigued by Rails. But in my outfit I''m not only the web person, but also the application person and the DBA. So when I read that Rails doesn''t want to handle things like "compound keys" I blew right by those claims, thinking, "no way." But before I go deeper, I
2009 Mar 31
3
serving xml
Hi All, I''m trying to serve some XML from my Rails 2.0 server. I have a Flash file that always reads its configuration from /home/gallery.xml So, I would like to build the contents from the database and serve it back to the flash file when it hits my xml url. If it was HTML that it was asking for then in my home controller I have a gallery method that serves back a gallery.html.erb
2007 Feb 26
24
Ruby/rails port of Cocoon/hibernate
Hi, I''m currently running an apache/jboss cocoon/flow/hibernate/ajax paypal (directpayment) project and am looking into the possibility of porting it across to ruby/rails. For that reason I would like to know the following: 1. Can I call my java classes or would I be looking at a complete rewrite in ruby? 2. How effective is ruby in terms of seperation of concerns regarding design from