Forum: Ruby on Rails Model inheritance is borken in Rails1.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nexus Neo (Guest)
on 2006-03-31 14:07
(Received via mailing list)
following is model code in file order_payment.rb
class OrderPayment < ActiveRecord::Base
  belongs_to :order
  validates_presence_of :amount, :no
end

class LC < OrderPayment
end

class LC30 < LC
end

class LC60 < LC
end

class LC90 < LC
end

class LC120 < LC
end

class TT < OrderPayment

end

class CAD < OrderPayment

end
and following is error i'm getting with rails1.1.0 above code is working
fine with rails1.0.0
NameError in Order#add_payment

uninitialized constant LC

RAILS_ROOT: script/../config/..
 Application Trace
<http://0.0.0.0:3000/order/add_payment?order_id=44#> | Framework
Trace <http://0.0.0.0:3000/order/add_payment?order_id=44#> | Full
Trace<http://0.0.0.0:3000/order/add_payment?order_id=44#>

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:112:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:120:in
`const_missing'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:122:in
`const_missing'
#{RAILS_ROOT}/app/controllers/order_controller.rb:61:in `add_payment'

 /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:112:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:120:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:122:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:908:in
`perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:355:in
`perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:379:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:364:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:117:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:38:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:115:in
`handle_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:81:in
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:67:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in
`require'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/server.rb:30
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in
`require'
./script/server:3

 /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:112:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:120:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:122:in
`const_missing'
#{RAILS_ROOT}/app/controllers/order_controller.rb:61:in `add_payment'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:908:in
`perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:355:in
`perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:379:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:364:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:117:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:38:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:115:in
`handle_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:81:in
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:67:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in
`require'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/server.rb:30
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in
`require'
./script/server:3

 This error occured while loading the following files:
   lc.rb

Request

*Parameters*: {"order_id"=>"44", "commit"=>"add",
"payment"=>{"no"=>"NON",
"date"=>"", "expiry_date"=>"", "type"=>"LC", "paid"=>"0",
"ship_date"=>"",
"amount"=>"23"}}

Show session dump <http://0.0.0.0:3000/order/add_payment?order_id=44#>
Response *Headers*: {"cookie"=>[], "Cache-Control"=>"no-cache"}
Mikkel B. (Guest)
on 2006-03-31 14:50
(Received via mailing list)
its a feature...not a bug...

http://dev.rubyonrails.org/ticket/4402


On Friday, March 31, 2006, at 2:04 AM, Nexus Neo wrote:
>end
>class TT < OrderPayment
>uninitialized constant LC
>/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/
>`const_missing'
>filters.rb:355:in
>`perform_action'
>/usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:115:in
>/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
>dependencies.rb:136:in
>dependencies.rb:122:in
>`perform_action_without_rescue'
>/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/
>/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
>/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
> This error occured while loading the following files:
>
>
>_______________________________________________
>Rails mailing list
>removed_email_address@domain.invalid
>http://lists.rubyonrails.org/mailman/listinfo/rails
>


Mikkel B.

www.strongside.dk    - Football Portal(DK)
ting.minline.dk      - Buy Old Stuff!(DK)
NexusNeo - Niket P. (Guest)
on 2006-03-31 15:00
(Received via mailing list)
Thanks it solved.


On 31 Mar 2006 10:46:02 -0000, Mikkel B. <
removed_email_address@domain.invalid> wrote:
> >  validates_presence_of :amount, :no
> >
> >class CAD < OrderPayment
> ><http://0.0.0.0:3000/order/add_payment?order_id=44#> | Framework
> >/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/
> >/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/
> >`perform_action_without_rescue'
> >/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/
> >`service'
> >/usr/lib/ruby/gems/1.8/gems/rails-1.1.0
> >./script/server:3
> >#{RAILS_ROOT}/app/controllers/order_controller.rb:61:in `add_payment'
> >/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/
> >`process_without_session_management_support'
> >/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
> >/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
> > This error occured while loading the following files:
> >Show session dump <http://0.0.0.0:3000/order/add_payment?order_id=44#>
> Mikkel B.
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
Best Regards,
Niket P.
For NexusNeo System
(A Div of NexusNeo System & Exim Pvt. Ltd)
Tel:  +91 79 23244557
Fax: +91 79 23246531
E-mail: removed_email_address@domain.invalid
Web:   www.nexusneo.com
This topic is locked and can not be replied to.