similar to: AWDWR : Validation Question

Displaying 20 results from an estimated 30000 matches similar to: "AWDWR : Validation Question"

2006 Aug 02
2
Help please: AWDWR -- Migration failure
I''m having a problem with one of the migration files from the depot application. ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == AddPrice: migrating ======================================================== -- add_column(:products, :price, :decimal, {:scale=>2, :default=>0, :precision=> 8}) rake aborted! You
2006 Jul 10
2
Problem with migrations, postgresql, AWDwR
Hi all, Rails 1.1.4 Rake 0.7.1 PostgreSQL 8.1.4 Windows XP Pro I checked for errata on pragmaticprogrammer.com, but didn''t see any explicit mention of this issue. I''m going over the depot example in AWDwR, 2nd ed, and I can''t get the migration to work on p. 82. Specifically, the AddTestData example (with reduced description text to save my fingers some typing):
2006 Jul 21
20
New version of AWDwR
Folks: I''ve uplaoded the B1.05 version of AWDwR. It fixes a number of reported errata (and a few that weren''t reported :), and adds two significant changes: 1. It now uses the new Active Record decimal -> BigDecimal conversion. I''ve personally been waiting for this for a long time, and I''m really happy it''s now part of core. However,
2006 Jul 29
2
Finding sum
# Get a list of product ids from a form, then # sum the total price product_list = params[:product_ids] total = Product.find(product_list).sum(&:price) I understand the first list line and part of the second line, but what does the & symbol mean? TIA.
2006 Apr 08
2
Issue with validation
Hello, I just got hold of the book ''Agile Web Development with Rails'' and I have been following along. I just went through a segment of trying to add validation to a form. I added the following code, as instructed, to my app/models/Products.rb file: protected def validate errors.add(:Price, "should be positive") unless Price.nil? || Price >= 0.01 end
2006 Jul 16
17
AWDWR question
In an early section on Action View, showing code being put directly into the rhtml file: <% require ''date'' DAY_NAMES = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday } today = Date.today %> <h1>Hello, Dave</h1> <p> It''s <%= DAY_NAMES[today.wday] %>. Tomorrow is <%= DAY_NAMES[(today + 1).wday %>. </p> I get this
2006 Jun 25
1
Unit Testing failure
When I run the unit testing code in Unit Testing Models chapter of the Agile Rails book, I get the following error: $ ruby test/unit/cart_test.rb Loaded suite test/unit/cart_test Started F. Finished in 0.21806 seconds. 1) Failure: test_add_duplicate_product(CartTest) [test/unit/cart_test.rb:22]: <4690> expected but was <3579>. 2 tests, 3 assertions, 1 failures, 0 errors require
2006 Jul 16
6
using collection_select
hello, supposing i have a User class that contains a Wibble class User < ActiveRecord::Base has_one :wibble end in my view i have <%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %> when i post, i get an error like "Wibble expected, got String" how/where am I supposed to convert this posted wibble_id into a Wibble, or am I using collection_select
2008 Oct 28
1
does qplot works with Sweave?
Hi Hadley: I'm practicing writing a document using MikTex but can't make qplot to execute. It works when using 'plot' though. Is this a normal behaviour? \documentclass[9pt]{article} \title{ggplot2 example} \begin{document} \maketitle \section*{Examples of using ggplot2} The goal is to be able to import ggplot2 graphics into the annual report. Hadley Wickham has done a great
2006 Feb 02
0
proposed bugfix/patch: ActiveRecord cross-module associations
Hi, I''m still test driving the improved support for module namespaces in rails and I''ve hit a problem with associations between AR classes in modules and AR classes in the root namespace. The long and short of it is I want to be able to say: Foo::Bar.belongs_to :wibble, :class_name => "::Wibble" If you don''t try to prefix ''Wibble''
2006 Oct 25
7
rest nested resources - Help please
I can''t believe I''m back again with another rest question. I did go through the peepcode podcast. I thought though you can have multiple nested resources, is that not true ? I have this set up map.resources :candidates do |candidate| candidate.resources :canbackgrounds candidate.resources :canpositions end I just coded up teh canpositions and now all
2006 Mar 15
4
New RadRails tutorial using AWDWR book
Hello there, I am basically a J2EE refugee fascinated with Rails. I have been using the Spring framework (a lightweight J2EE java framework with some special characteristics) but I am so impressed with RoR that I am porting over many applications. In order to "dive into Rails", of course the second thing to do was get myself an IDE, and since I''ve been using Eclipse for the
2006 Feb 07
1
AWDWR: NameError (uninitialized constant UnknownAction) in rescue_action_in_public
I copied (and modified) this code from AWDWR: def rescue_action_in_public(exception) case exception when ActiveRecord::RecordNotFound, ActionController::UnknownAction render :template=>''/error'', :layout=>''application'', :status=>''404 Not Found'' else render :template=>''/error'',
2010 Jul 21
0
Validation in R for GAMM
My GAMM model is to find drivers of species richness in forests is gamm1<- gamm(Total Species Richness ~ fROT + s(PH) + s(LOI) + ASP + s(SQRT_ELEV) + CANCOV + s(SQRT_TOTCWD) + s(WELLF) + s(WELLN) + s(OLDWDLD) + s(DISTWOOD) + s(Annprec), random=list (fSITE =~1), family = poisson, data = BIOFOR3) My issues are that the validation graphs are using methods I'm unfamiliar with e.g. square
2008 Mar 01
2
No route matches with {:method=>:get} Error in AWDWR Book
Hi I''m working on the AWDWR book and I''m on the admin section of the book. I have rails 2 installed on my machine and I have ran into an error when I created my controller login but when I go to http://localhost:3000/login/index I get this error: No route matches "/login/index" with {:method=>:get} I haven''t touched the routes.rb file and when I generated
2006 Nov 04
0
New version of the AWDwR beta book available
I''ve uploaded the B1.12 version of AWDwR. The major changes include: - Justin Gehtland''s new chapter on Web 2.0 - James Duncan Davisdon''s chapter on deployment (this is an interesting one---JDD has strong opinions on how a Rails application should be deployed, and the chapter mirrors this. You''ll find it short and easy to follow). - I changed the
2006 Aug 14
1
AWDWR Chpt6: Webrick Get...200... then ...500...
Hi, Rails produces to diff Gets on the Webrick: AWDWR Chpt 6 strange results: First browser call to /Admin shows correct form; - And WEBrick reports: "Get /admin HTTP/1.1" 200 485 - -> /admin Subsequent browser calls to /Admin show: NoMethodError in AdminController#index undefined method `each'' for #<Mysql:0x37aba80> - And WEBrick reports: "Get /admin
2006 May 05
0
(P)review of AWDwR and R4R
Hello, A lot of discussion is going on about AWDwR 2nd ed, i have decided to write an entry about it (and R4R) after reading few chapters: http://www.rubyrailways.com/fisrt-impressions-of-awdr-2nd-ed-and-r4r/ Cheers, Peter
2007 Oct 29
1
pairs, par
Hi, I posted over at R-help, and didn't get a response, but perhaps that was the wrong forum for this question. I'm having some confusion over the coordinate system after using pairs. I'm not interested in the content of the actual pairs plot, although the number of pairs seems to matter a bit. I'm purely interested in knowing where subsequent points will be plotted on the
2007 Feb 06
2
Testing RJS actions
Hi all ! This is my test: def test_destroy_xhr Article.expects(:find).with("1").returns(@article = mock("article")) @article.expects(:destroy).returns(true) delete :destroy, :id => 1, :format => :js assert_template "destroy.rjs" end And my implementation: def destroy @article.destroy respond_to do |format| format.html {