firman syah | 3 Dec 10:50 2008
Picon

preloaded class

Mas2...
mo tanya, kalau preloaded class taruhnya dimana?
saya coba masukin di bawah model, trus diload sebagai module di application
controller. Ternyata malah error.

./app/models:
cart.rb        item.rb        purchase.rb

application.rb:
class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  model  :cart
  model :purchase
.....

error:
=> Booting WEBrick...
/~home/Rails/store/app/controllers/application.rb:6: undefined method
`model' for ApplicationController:Class (NoMethodError)
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:216:in
`load_without_new_constant_marking'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:216:in
`load_file'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in
`new_constants_in'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:215:in
`load_file'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:96:in
`require_or_load'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:61:in
`depend_on'
    from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:457:in
`require_dependency'
    from
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:18:in
`define_dispatcher_callbacks'
     ... 25 levels...
    from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/server.rb:39
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
    from script/server:3

thanks.. :)

[Non-text portions of this message have been removed]

------------------------------------

ID-Ruby
Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian Ruby (JRuby, Rubinius,
IronRuby, XRuby), dan program yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)

<*> Kunjungi *arsip milis* id-ruby di
    http://groups.yahoo.com/group/id-ruby/messages
    http://www.mail-archive.com/id-ruby-hHKSG33TihhbjbujkaE4pw <at> public.gmane.org/
    http://rubyurl.com/Q8DD
    http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia

<*> Baca peraturan id-ruby sebelum posting
    http://rubyurl.com/gay1

<*> Ikutilah Jajak Pendapat ID-Ruby
    http://rubyurl.com/3CCt

<*> Links ID-Ruby
    http://rubyurl.com/n96r

<*> Database ID-Ruby
    http://rubyurl.com/Iw3u

<*> Kunjungi Situs Resmi Ruby Indonesia
    http://www.ruby-lang.org/id/

<*> Join Ruby Indonesia on Facebook
    http://rubyurl.com/QV48

<*> Join Ruby Indonesia on LinkedIn
    http://rubyurl.com/eh0i

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/id-ruby/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/id-ruby/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:id-ruby-digest@... 
    mailto:id-ruby-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    id-ruby-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Gmane