Wrox Programmer Forums
|
BOOK: Beginning Ruby on Rails
This is the forum to discuss the Wrox book Beginning Ruby on Rails by Steve Holzner Ph.D.; ISBN: 9780470069158
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Ruby on Rails section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2010, 12:57 PM
Registered User
 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 Page 206

Hi

Just want to know how to preload classes inside ApplicationControler.
See page 206 ch07
Here is the code

class ApplicationController < ActionController::Base
model:cart
model: purchase

end

Rails does not recognize model .It say undefined method model.

How to include cart and purchase model in ApplicationController?

Thanks
Talley
 
Old January 18th, 2010, 01:31 PM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default Work around?

I encountered the same issue and after poking around I tried
Code:
class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details

  # Pg. 206 - Doesn't work in Rails 2.x
  # model :cart
  # model :purchase
  require 'Cart'
  require 'Purchase'

end
It got past the error, not sure if it is doing what it is suppose to or not.
Patrick





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 2 - page 41 problem creating the page.. jorjiana BOOK: Beginning Oracle Application Express ISBN: 9780470388372 2 August 22nd, 2009 04:25 AM
Chapter 3 page 95 nead23 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 March 26th, 2009 09:28 AM
Chapter 7 Try It Out page 218 drumdiva BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 3 March 19th, 2007 08:35 PM
trim function on page 206 jackhsu BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 December 19th, 2006 01:46 PM
Chapter 5 page 151 aztek BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 July 27th, 2006 06:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.