Jefflin Huang
2010-Mar-25 23:45 UTC
NoMethodError (private method `chomp'' called for nil:NilClas
Hi: I am using Rails 2.3.5 with paperclip, mime-types and uploadify. So far the application is working in development environment. But when I switched to the production environment, it produced the following error. NoMethodError (private method `chomp'' called for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:665:in `type_for'' /usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:730:in `type_for'' app/controllers/assets_controller.rb:180:in `new_asset_from_params'' haml (2.2.22) rails/./lib/sass/plugin/rails.rb:20:in `process'' app/middleware/flash_session_cookie_middleware.rb:15:in `call'' It seems that the error has something to do with Mime-types. But I could not work it out. Does anyone have the similar issue or possible suggestions? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-26 08:53 UTC
Re: NoMethodError (private method `chomp'' called for nil:NilClas
On 25 March 2010 23:45, Jefflin Huang <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi: > > I am using Rails 2.3.5 with paperclip, mime-types and uploadify. So far > the application is working in development environment. But when I > switched to the production environment, it produced the following error. > > NoMethodError (private method `chomp'' called for nil:NilClass): > /usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:665:in > `type_for'' > /usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:730:in > `type_for'' > app/controllers/assets_controller.rb:180:in `new_asset_from_params''So what is this line (and a few around it)? Colin> haml (2.2.22) rails/./lib/sass/plugin/rails.rb:20:in `process'' > app/middleware/flash_session_cookie_middleware.rb:15:in `call'' > > It seems that the error has something to do with Mime-types. But I could > not work it out. Does anyone have the similar issue or possible > suggestions? > > Thanks > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jefflin Huang
2010-Mar-27 02:51 UTC
Re: NoMethodError (private method `chomp'' called for nil:NilClas
Hi: new_asset_from_params is used to create the Asset object based on the parameters from URL. This method as been assigned as a before_filter. And after extended logging of the code, I finally figured out the problem. The problem was caused my own doing really. It turns out that I have made a copy of the assets_controller.rb as ''Copy of assets_controller.rb'' under the controllers directory before. Under the development environment, everything works. But under production environment, it seems that rails loads both controllers and executed the new_asset_from_params twice. The first time, everything was working fine. But at the second time, it caused the error. After I removed the copy of the assets_controller, the application works without any issue. So thanks for reading the issue I had. But if anyone can share some light on why the behaviors are different between production and development environment in my case, that will be very helpful for my understanding. regards Jefflin Colin Law wrote:> On 25 March 2010 23:45, Jefflin Huang <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> `type_for'' >> �app/controllers/assets_controller.rb:180:in `new_asset_from_params'' > > So what is this line (and a few around it)? > > Colin-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Reasonably Related Threads
- Rails 3 -NoMethodError (undefined method `original_filename
- [PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.
- NoMethodError in StoreController#add_to_cart -> getting nil
- keep getting "undefined method `map' for nil:NilClass (NoMethodError) " in new server
- has_one :through NoMethodError: undefined method `klass' for nil:NilClass when doing class_name on reflection