have a controller AddressesController model :address scaffold :address have model Address scaffold reports that it can find the constant Addres and is trying to load addres.rb instead of address.rb thoughts? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 5/13/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote:> have a controller AddressesController > > model :address > scaffold :address > > have model Address > > scaffold reports that it can find the constant Addres and is trying to > load addres.rb instead of address.rb > > thoughts? >Never seen that before, but I do have some suggestions. Try it without the "model :address" part. It should work with just the scaffold line. If that does not work, then try again with something like "scaffold :address, :class_name=>''Address'' " Jason
Sean T Allen wrote:> have a controller AddressesController > > model :address > scaffold :address > > have model Address > > scaffold reports that it can find the constant Addres and is trying to > load addres.rb instead of address.rb > > thoughts?I have seen this. I may be wrong (could happen) but I think it is because of TMC (too much cleverness) on the part of rails. Is your table named Address? What if it was named Addresss? Am I close? xev
Jason Foreman wrote:>On 5/13/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote: > > >>have a controller AddressesController >> >>model :address >>scaffold :address >> >>have model Address >> >>scaffold reports that it can find the constant Addres and is trying to >>load addres.rb instead of address.rb >> >>thoughts? >> >> >> > >Never seen that before, but I do have some suggestions. Try it >without the "model :address" part. It should work with just the >scaffold line. If that does not work, then try again with something >like "scaffold :address, :class_name=>''Address'' " > >replying to both emails that came in... table name is Addresses taking out the model works... after generating scaffolding ( w/ script/generate ) its fine until i try to do an eager load with :include then the problem pops up again database is postgresql with the pure ruby driver... webrick as the server simple setup as i''m just testing out some ideas... if i change to :include => [ :addresss ] just to see if it was a too clever thing, it tries to load addresss.rb _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Sean T Allen wrote:> have a controller AddressesController > > model :address > scaffold :address > > have model Address > > scaffold reports that it can find the constant Addres and is trying to > load addres.rb instead of address.rb > > thoughts?I am experiencing the fog of war a bit here... My last answer was based on some vague memories. After some thought, I recall this: The last time I saw this was: I had a table named "users". When I ran the model and controller generate scripts, I gave them the same name as the table - "users" instead of the singular "user". Shortly thereafter I had much confusion wondering why I was getting the "can''t find constant User" message. xev
Sean T Allen wrote:> Jason Foreman wrote: > >> On 5/13/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote: >> >> >>> have a controller AddressesController >>> >>> model :address >>> scaffold :address >>> >>> have model Address >>> >>> scaffold reports that it can find the constant Addres and is trying to >>> load addres.rb instead of address.rb >>> >>> thoughts? >>> >>> >> >> >> Never seen that before, but I do have some suggestions. Try it >> without the "model :address" part. It should work with just the >> scaffold line. If that does not work, then try again with something >> like "scaffold :address, :class_name=>''Address'' " >> >> > replying to both emails that came in... > > table name is Addresses > > taking out the model works... >correction on that... havig either model of scaffold causes the problem... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Xevious wrote:> Sean T Allen wrote: > >> have a controller AddressesController >> >> model :address >> scaffold :address >> >> have model Address >> >> scaffold reports that it can find the constant Addres and is trying >> to load addres.rb instead of address.rb >> >> thoughts? > > > I am experiencing the fog of war a bit here... My last answer was > based on some vague memories. After some thought, I recall this: > > The last time I saw this was: > > I had a table named "users". When I ran the model and > controller generate scripts, I gave them the same name > as the table - "users" instead of the singular "user". > > Shortly thereafter I had much confusion wondering why I > was getting the "can''t find constant User" message. >I dont think that is happening with me I did... script/generate model address scirpt/generate controller addresses thats it... address just has a belongs_to relationship in it controller just has the scaffold :address and model :address _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Sean T Allen wrote:> I dont think that is happening with me I did... > > script/generate model address > scirpt/generate controller addresses > > thats it...Indeed, and if I am a moss researcher and create a table named "Mosses" and do: script/generate model moss script/generate controller mosses I will get the same results as you: uninitialized constant Mos This error occured while loading the following files: mos.rb OTOH, if I do: script/generate model mosss (and change mosses_controller.rb accordingly to "scaffold :mosss") Everything is happy. Except for me. (because of the TMC) I detest these kinds of hidden side-effects. I am sure the documentation indicates the right way to do this. I haven''t got to that part yet as this is just my third day playing with Rails. xev
Xevious wrote:> Sean T Allen wrote: > >> I dont think that is happening with me I did... >> >> script/generate model address >> scirpt/generate controller addresses >> >> thats it... > > > > Indeed, and if I am a moss researcher and create a table named > "Mosses" and do: > > script/generate model moss > script/generate controller mosses > > I will get the same results as you: > > uninitialized constant Mos > This error occured while loading the following files: > mos.rb > > OTOH, if I do: > > script/generate model mosss > (and change mosses_controller.rb accordingly to "scaffold :mosss") > > Everything is happy. > > Except for me. (because of the TMC) > > I detest these kinds of hidden side-effects. I am sure the documentation > indicates the right way to do this. I haven''t got to that part yet as > this is just my third day playing with Rails. >Try with mosses/new I am able to get addresses/new to work... It appears I only have a problem with ''list'' as the command... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Sean T Allen wrote:> Try with mosses/new > > I am able to get addresses/new to work... > > It appears I only have a problem with ''list'' as the command...Once again, I could be mistaken - however, I believe that the inability of ActiveSupport''s inflector.rb to recognize that "ss" often isn''t plural is the issue. Replacing the singular rule: [/s$/i, ''''] with: [/[^s]s$/i, ''''] in inflector.rb works for me but may not be the best solution as my regexp skills are a bit rusty. xev