Is "file" reserved? Can i use it for my model name? Because I am getting this error- NoMethodError in FilesController#new undefined method `quoted_table_name'' for File:Class -- 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.
uGH! im answering my own questions!. sorry guys ill think b4 i post next time. here are the reserved words- http://newwiki.rubyonrails.org/rails/pages/reservedwords On Apr 22, 8:44 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is "file" reserved? Can i use it for my model name? Because I am > getting this error- > > NoMethodError in FilesController#new > > undefined method `quoted_table_name'' for File:Class > > -- > 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 athttp://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.
Thanks for sharing that URL. Yeah, I''ve ran into a couple myself. Yeah, File is definitely a Ruby class name, which is inherited from the IO class. I tried making a model called both Application and Type in the same app actually. Let''s just say it didn''t go too well... ;) On Apr 22, 7:47 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> uGH! im answering my own questions!. sorry guys ill think b4 i post > next time. > > here are the reserved words-http://newwiki.rubyonrails.org/rails/pages/reservedwords > > On Apr 22, 8:44 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Is "file" reserved? Can i use it for my model name? Because I am > > getting this error- > > > NoMethodError in FilesController#new > > > undefined method `quoted_table_name'' for File:Class > > > -- > > 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 athttp://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 athttp://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.
You can get by "reusing" a class name, but it''s a PITA. I had a model named Filter, then upgraded Rails at one point, and all sorts of ugly conflicts occurred since the new version of Rails included a Filter clas. One solution is to reference the class to the local namespace, such as in the controller: @filters = ::Filter.find(blah blah blah) While it can be done, I wouldn''t ever do it again. -- 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.
Ar Chron wrote:> You can get by "reusing" a class name, but it''s a PITA. > > I had a model named Filter, then upgraded Rails at one point, and all > sorts of ugly conflicts occurred since the new version of Rails included > a Filter clas. > > One solution is to reference the class to the local namespace, such as > in the controller: > > @filters = ::Filter.find(blah blah blah)I believe that would be the global namespace, no?> > While it can be done, I wouldn''t ever do it again.Yeah. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
On Apr 23, 2:43 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Ar Chron wrote: > > You can get by "reusing" a class name, but it''s a PITA. > > > I had a model named Filter, then upgraded Rails at one point, and all > > sorts of ugly conflicts occurred since the new version of Rails included > > a Filter clas. > > > One solution is to reference the class to the local namespace, such as > > in the controller: > > > @filters = ::Filter.find(blah blah blah) > > I believe that would be the global namespace, no? >That works because ActionController creates ActionController::Filter, but ruby''s File class is also at the top level so I don''t think you''d have much luck there Fred> > > > While it can be done, I wouldn''t ever do it again. > > Yeah. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://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 athttp://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.