Luis Lavena
2010-Apr-19 14:42 UTC
[Mongrel] Problem with mongrel_rails, but works with script/server
On Mon, Apr 19, 2010 at 9:21 AM, <rpavesic at gmail.com> wrote:> Hi there, I am having problem with mongrel_rails and > I do not know whom to ask so I found your e-mail as > one of the last people contributing to mongrel_rails, so > may be you would be able to help me out. >Please, email mongrel-users mailing list for problems, so in that way all benefit from the answers. http://rubyforge.org/mailman/listinfo/mongrel-users> Here is the problem: > My platform is XP, ruby 1.8.6, rails 2.3.2. mongrel-1.1.5-x86-mswin32-60, > mongrel_service-0.3.4-x86-mswin32. > > I have my application working perfectly when I start it with > "script/server", but > when ?I "use mongrel_rails start" it starts the app but on several > controllers it breaks (not all of them though <-how come???) and when it > braks ti shows the > message "undefined method `reflect_on_association'' for Service:Module" >Do you have a model called Service? mongrel_service it also contains a module called Service, so maybe ActiveRecord might be clashing, which is strange. Please provide a backtrace of the error, not just the last line of the error.> When I set the break point in,the action of the controller where it breaks, > and > when the processing stop on this break point and if I type > ?>params > It says >>"Unknown command: "params". Try "help" > but If I type >>eval params > it shows me the correct content of params hash: >> {"action"=>"index", "controller"=>"doctor"}. > > Also if I type >>@_params > it says >>"Unknown commad" "@_params". Try "help" > but if I type >>eval @_params > it responds properly >> {"action"=>"index", "controller"=>"doctor"} > > It even do not understands.If you''re using ruby-debug, you need to eval to get information from the process you''re debugging, you can''t call params directly.> Please help me if you can or may be direct me to somewhere where I could > find help, advise or answers. >Please provide a full backtrace, you might be using a served word for a controller or model that could be clashing with Mongrel, Rails or mongrel_service. Also, join and respond to mongrel-users mailing list, so all benefit from the findings. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry
Luis Lavena
2010-Apr-19 17:21 UTC
[Mongrel] Problem with mongrel_rails, but works with script/server
On Mon, Apr 19, 2010 at 2:07 PM, <rpavesic at gmail.com> wrote:> Hi Luis, thank you very much for the answer. Using eval (per your > suggestion:)) I was > able to start debugging the problem. > The error shows up when executing the following statement: > @customers=provider.customers > > Here is the full error log that > gets shown on the browser: > ------>>>>>--------- > > undefined method `reflect_on_association'' for Service:Module > > RAILS_ROOT: C:/RubyOnRails/rails_apps/msms > Application Trace | Framework Trace | Full Trace > > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/reflection.rb:257:in `source_reflection'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/reflection.rb:257:in `collect'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/reflection.rb:257:in `source_reflection'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/reflection.rb:288:in `check_validity!'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/associations/has_many_through_association.rb:5:in `initialize'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/associations.rb:1277:in `new'' > C:/RubyOnRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_rec > ord/associations.rb:1277:in `customers'' > C:/RubyOnRails/rails_apps/msms/app/controllers/doctor_controller.rb:17:in > `index'' > ---------<<<<<<<<<----- > > I have the following relatonships relating to this problem in my models: > > class Provider < ActiveRecord::Base > ? ? ? ?has_many :services > ? ? ? ?has_many :customers, :through => :services > ? ? ?...... > ? ? ? ?..... > end > > class Service < ActiveRecord::Base > ? ? ? ?belongs_to :provider > ? ? ? ?belongs_to :customer > ? ? ? ?belongs_to :invoice > ? ? ?...... > ? ? ? ?..... > end > > class Customer < ActiveRecord::Base > ? ? ? ?has_many :services > ? ? ? ?has_many :providers, :through => :services > ? ? ? ?has_many :invoices, :dependent=> :destroy > ? ? ?...... > ? ? ? ?..... > end > > class Invoice < ActiveRecord::Base > ? ? ? ?has_many :services > ? ? ? ?belongs_to :customer > ? ? ?...... > ? ? ? ?..... > end > > What is puzzling is that if I use "script/server" (which starts the mongrel) > all works fine, > but if I use "mongrel_rails start" this error shows up. What is diffenrent > under the hub between > these two?script/server initializes Rails before Mongrel, while mongrel_rails does the opposite. Since you''ve installed mongrel_service gem, it defines a Service module, which is used as plugin to install inside mongrel how command functionality: http://github.com/fauna/mongrel_service/blob/master/lib/mongrel_service/init.rb#L8-9 If you aren''t using mongrel_service, I would suggest you remove the gem. The problem is that the plugin for mongrel can''t be named differently. If we do, then will break compatibility with old versions. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry
Possibly Parallel Threads
- mongrel/mongrel_rails windows question
- mongrel_rails service on windows incompatible with recent ruby builds?
- Mongrel service will not start on win32 w/ --prefix option
- Mongrel fails in Win32, mongrel_service missing, with possible fix
- offline/local install of mongrel_service