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
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
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
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.
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,
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