I new to rails. I have a setup in the lib directory like so: lib/ blog/ core/ search/ base.rb The base.rb defines the Base class as well: module Blog module Core module Search class Base attr_accessor :properties def initialize(params) @properties = {} end end end end end I have the following code in my application.rb config.autoload_paths += Dir["#{config.root}/lib/**/"] When I include it in posts controller I get following errors: LoadError in PostsController#index Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base Any idea? I''m using rails 3.2.5 with RVM. Thank you for every advice. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/LTqvmjiNMjsJ. 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.
Added my full stack Started GET "/admin/posts" for 127.0.0.1 at 2012-06-08 21:06:18 +0800 LoadError (Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base): app/controllers/admin/base_controller.rb:5:in `<top (required)>'' app/controllers/admin/posts_controller.rb:6:in `<top (required)>'' Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.9ms) Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms) Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.0ms) Please help me. On Friday, June 8, 2012 8:54:19 PM UTC+8, Zeck wrote:> > I new to rails. I have a setup in the lib directory like so: > > lib/ > blog/ > core/ > search/ > base.rb > > The base.rb defines the Base class as well: > > module Blog > module Core > module Search > class Base > > attr_accessor :properties > > def initialize(params) > @properties = {} > end > end > end > end > end > > I have the following code in my application.rb > > config.autoload_paths += Dir["#{config.root}/lib/**/"] > > When I include it in posts controller I get following errors: > > LoadError in PostsController#index > > Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base > > Any idea? I''m using rails 3.2.5 with RVM. Thank you for every advice. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/h3nj9T98yYMJ. 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.
This is kind of interesting. I want to spend some time tomorrow to debug this kind of issues (that happens very frequently), unless someone gets to it first. -- Oscar Del Ben Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Friday, June 8, 2012 at 6:14 AM, Zeck wrote:> > Added my full stack > > Started GET "/admin/posts" for 127.0.0.1 at 2012-06-08 21:06:18 +0800 > > LoadError (Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base): > app/controllers/admin/base_controller.rb:5:in `<top (required)>'' > app/controllers/admin/posts_controller.rb:6:in `<top (required)>'' > > > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org (mailto:ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org)/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.9ms) > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org (mailto:ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org)/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms) > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org (mailto:ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org)/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.0ms) > > Please help me. > On Friday, June 8, 2012 8:54:19 PM UTC+8, Zeck wrote: > > > > I new to rails. I have a setup in the lib directory like so: > > > > lib/ > > blog/ > > core/ > > search/ > > base.rb > > > > The base.rb defines the Base class as well: > > > > module Blog > > module Core > > module Search > > class Base > > > > attr_accessor :properties > > > > def initialize(params) > > @properties = {} > > end > > end > > end > > end > > end > > > > I have the following code in my application.rb > > > > config.autoload_paths += Dir["#{config.root}/lib/**/"] > > > > When I include it in posts controller I get following errors: > > > > LoadError in PostsController#index > > > > Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base > > > > Any idea? I''m using rails 3.2.5 with RVM. Thank you for every advice. > > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/h3nj9T98yYMJ. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Is it bug? On Saturday, June 9, 2012 12:26:29 AM UTC+8, Oscar Del Ben wrote:> > This is kind of interesting. I want to spend some time tomorrow to debug > this kind of issues (that happens very frequently), unless someone gets to > it first. > > -- > Oscar Del Ben > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Friday, June 8, 2012 at 6:14 AM, Zeck wrote: > > Added my full stack > > Started GET "/admin/posts" for 127.0.0.1 at 2012-06-08 21:06:18 +0800 > > LoadError (Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base): > app/controllers/admin/base_controller.rb:5:in `<top (required)>'' > app/controllers/admin/posts_controller.rb:6:in `<top (required)>'' > > > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.9ms) > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms) > Rendered /home/usr/.rvm/gems/ruby-1.9.3-p194-qF5MFtZkOSZG4mHArVOXVA@public.gmane.org/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.0ms) > > > Please help me. > > On Friday, June 8, 2012 8:54:19 PM UTC+8, Zeck wrote: > > I new to rails. I have a setup in the lib directory like so: > > lib/ > blog/ > core/ > search/ > base.rb > > The base.rb defines the Base class as well: > > module Blog > module Core > module Search > class Base > > attr_accessor :properties > > def initialize(params) > @properties = {} > end > end > end > end > end > > I have the following code in my application.rb > > config.autoload_paths += Dir["#{config.root}/lib/**/"] > > When I include it in posts controller I get following errors: > > LoadError in PostsController#index > > Expected /home/usr/code/blog/lib/blog/core/search/base.rb to define Base > > Any idea? I''m using rails 3.2.5 with RVM. Thank you for every advice. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/h3nj9T98yYMJ. > 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. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/L2nHYeB3pQcJ. 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.
On Friday, 8 June 2012 08:54:19 UTC-4, Zeck wrote:> > I new to rails. I have a setup in the lib directory like so: > > lib/ > blog/ > core/ > search/ > base.rb > > The base.rb defines the Base class as well: > > module Blog > module Core > module Search > class Base > > attr_accessor :properties > > def initialize(params) > @properties = {} > end > end > end > end > end > > I have the following code in my application.rb > > config.autoload_paths += Dir["#{config.root}/lib/**/"] > > >Try just adding lib/ to autoload_paths - the ** part is tripping it up, so it''s deciding that your file should define ''Base'', not Blog::Core::Search::Base. BTW, if you''re new to Rails you may want to try learning it more idiomatically before dumping a jumbo-sized bucket of OO overdesign on it with all these modules... --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0tVtoR5Z7xUJ. 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.