Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > BOOK: Beginning Ruby on Rails
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 4th, 2010, 11:57 AM
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
  #2 (permalink)  
Old January 18th, 2010, 12:31 PM
Registered User
 
Join Date: May 2007
Location: , , .
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
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12: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



All times are GMT -4. The time now is 06:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.