Hi, I have a table named campuses, and if I try to generate the scaffold, I get this error after edit.rhtml: Before updating scaffolding from new DB schema, try creating a table for your model (Campus). The command I used was: ruby script\generate scaffold Campus Campuses Can someone help me out? Thanks! - Ivan V.
You will need to add the campus pluralization rules to config/environment.rb. Find the section that looks like this: # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, ''\1en'' # inflect.singular /^(ox)en/i, ''\1'' # inflect.irregular ''person'', ''people'' # inflect.uncountable %w( fish sheep ) # end The easiest way is to do this: Inflector.inflections do |inflect| inflect.irregular ''campus'', ''campuses'' end -Lee On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I have a table named campuses, and if I try to generate the scaffold, I > get this error after edit.rhtml: > > Before updating scaffolding from new DB schema, try creating a table for > your model (Campus). > > The command I used was: ruby script\generate scaffold Campus Campuses > > Can someone help me out? > > Thanks! > > - Ivan V. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Oddly enough I''m having a similar problem... I''ve added inflect.irregular ''campus'', ''campuses'' under to environment.rb I am getting the error: "uninitialized constant Campu" from line reading: @campus_pages, @campuses = paginate :campus, :per_page => 10 Its like it thinks I''m telling it "campu" plural is "campuses" Any ideas? On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You will need to add the campus pluralization rules to > config/environment.rb. Find the section that looks like this: > > # Add new inflection rules using the following format > # (all these examples are active by default): > # Inflector.inflections do |inflect| > # inflect.plural /^(ox)$/i, ''\1en'' > # inflect.singular /^(ox)en/i, ''\1'' > # inflect.irregular ''person'', ''people'' > # inflect.uncountable %w( fish sheep ) > # end > > The easiest way is to do this: > > Inflector.inflections do |inflect| > inflect.irregular ''campus'', ''campuses'' > end > > -Lee > > On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > I have a table named campuses, and if I try to generate the scaffold, I > > get this error after edit.rhtml: > > > > Before updating scaffolding from new DB schema, try creating a table for > > your model (Campus). > > > > The command I used was: ruby script\generate scaffold Campus Campuses > > > > Can someone help me out? > > > > Thanks! > > > > - Ivan V. > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Change: @campus_pages, @campuses = paginate :campus, :per_page => 10 To: @campus_pages, @campuses = paginate :campuses, :per_page => 10 -Jonathan On Nov 4, 2005, at 12:52 PM, Joe Toth wrote:> Oddly enough I''m having a similar problem... > > I''ve added inflect.irregular ''campus'', ''campuses'' under to > environment.rb > > I am getting the error: "uninitialized constant Campu" > from line reading: @campus_pages, @campuses = > paginate :campus, :per_page => 10 > > Its like it thinks I''m telling it "campu" plural is "campuses" > > Any ideas? > > On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> You will need to add the campus pluralization rules to >> config/environment.rb. Find the section that looks like this: >> >> # Add new inflection rules using the following format >> # (all these examples are active by default): >> # Inflector.inflections do |inflect| >> # inflect.plural /^(ox)$/i, ''\1en'' >> # inflect.singular /^(ox)en/i, ''\1'' >> # inflect.irregular ''person'', ''people'' >> # inflect.uncountable %w( fish sheep ) >> # end >> >> The easiest way is to do this: >> >> Inflector.inflections do |inflect| >> inflect.irregular ''campus'', ''campuses'' >> end >> >> -Lee >> >> On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> Hi, >>> >>> I have a table named campuses, and if I try to generate the >>> scaffold, I >>> get this error after edit.rhtml: >>> >>> Before updating scaffolding from new DB schema, try creating a >>> table for >>> your model (Campus). >>> >>> The command I used was: ruby script\generate scaffold Campus >>> Campuses >>> >>> Can someone help me out? >>> >>> Thanks! >>> >>> - Ivan V. >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
It worked, thanks...and I kinda understand why because it attempts to singularize the name and it thinks campus is a plural. But why? I already added the irregular inflection, shouldn''t it detect its already singular? Thanks On 11/4/05, Jonathan Younger <daikini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Change: > @campus_pages, @campuses = paginate :campus, :per_page => 10 > > To: > @campus_pages, @campuses = paginate :campuses, :per_page => 10 > > -Jonathan > > On Nov 4, 2005, at 12:52 PM, Joe Toth wrote: > > > Oddly enough I''m having a similar problem... > > > > I''ve added inflect.irregular ''campus'', ''campuses'' under to > > environment.rb > > > > I am getting the error: "uninitialized constant Campu" > > from line reading: @campus_pages, @campuses > > paginate :campus, :per_page => 10 > > > > Its like it thinks I''m telling it "campu" plural is "campuses" > > > > Any ideas? > > > > On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> You will need to add the campus pluralization rules to > >> config/environment.rb. Find the section that looks like this: > >> > >> # Add new inflection rules using the following format > >> # (all these examples are active by default): > >> # Inflector.inflections do |inflect| > >> # inflect.plural /^(ox)$/i, ''\1en'' > >> # inflect.singular /^(ox)en/i, ''\1'' > >> # inflect.irregular ''person'', ''people'' > >> # inflect.uncountable %w( fish sheep ) > >> # end > >> > >> The easiest way is to do this: > >> > >> Inflector.inflections do |inflect| > >> inflect.irregular ''campus'', ''campuses'' > >> end > >> > >> -Lee > >> > >> On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> Hi, > >>> > >>> I have a table named campuses, and if I try to generate the > >>> scaffold, I > >>> get this error after edit.rhtml: > >>> > >>> Before updating scaffolding from new DB schema, try creating a > >>> table for > >>> your model (Campus). > >>> > >>> The command I used was: ruby script\generate scaffold Campus > >>> Campuses > >>> > >>> Can someone help me out? > >>> > >>> Thanks! > >>> > >>> - Ivan V. > >>> > >>> _______________________________________________ > >>> Rails mailing list > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>> > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Fri, 2005-04-11 at 16:03 -0500, Joe Toth wrote:> It worked, thanks...and I kinda understand why because it attempts to > singularize the name and it thinks campus is a plural. But why? I > already added the irregular inflection, shouldn''t it detect its > already singular?inflect.irregular ''campus'', ''campuses'' teaches it this: singular: campus. plural: campuses. The paginate line is seeing :campus as a plural, and wants to thus singularize it as campu. I did something similar, you could try this to get around the campus->campu issue, though it might be better to leave it erroring and use Jonathan''s correct fix. inflect.singular /^(campus)es/i, ''\1'' - Jamie> Thanks > > On 11/4/05, Jonathan Younger <daikini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Change: > > @campus_pages, @campuses = paginate :campus, :per_page => 10 > > > > To: > > @campus_pages, @campuses = paginate :campuses, :per_page => 10 > > > > -Jonathan > > > > On Nov 4, 2005, at 12:52 PM, Joe Toth wrote: > > > > > Oddly enough I''m having a similar problem... > > > > > > I''ve added inflect.irregular ''campus'', ''campuses'' under to > > > environment.rb > > > > > > I am getting the error: "uninitialized constant Campu" > > > from line reading: @campus_pages, @campuses > > > paginate :campus, :per_page => 10 > > > > > > Its like it thinks I''m telling it "campu" plural is "campuses" > > > > > > Any ideas? > > > > > > On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> You will need to add the campus pluralization rules to > > >> config/environment.rb. Find the section that looks like this: > > >> > > >> # Add new inflection rules using the following format > > >> # (all these examples are active by default): > > >> # Inflector.inflections do |inflect| > > >> # inflect.plural /^(ox)$/i, ''\1en'' > > >> # inflect.singular /^(ox)en/i, ''\1'' > > >> # inflect.irregular ''person'', ''people'' > > >> # inflect.uncountable %w( fish sheep ) > > >> # end > > >> > > >> The easiest way is to do this: > > >> > > >> Inflector.inflections do |inflect| > > >> inflect.irregular ''campus'', ''campuses'' > > >> end > > >> > > >> -Lee > > >> > > >> On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> Hi, > > >>> > > >>> I have a table named campuses, and if I try to generate the > > >>> scaffold, I > > >>> get this error after edit.rhtml: > > >>> > > >>> Before updating scaffolding from new DB schema, try creating a > > >>> table for > > >>> your model (Campus). > > >>> > > >>> The command I used was: ruby script\generate scaffold Campus > > >>> Campuses > > >>> > > >>> Can someone help me out? > > >>> > > >>> Thanks! > > >>> > > >>> - Ivan V. > > >>> > > >>> _______________________________________________ > > >>> Rails mailing list > > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > > >>> > > >> _______________________________________________ > > >> Rails mailing list > > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > >> > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
My bad. the inflection at the end should be: inflect.singular /^(campus)(es)?/i, ''\1'' - Jamie On Fri, 2005-04-11 at 17:28 -0800, Jamie Macey wrote:> On Fri, 2005-04-11 at 16:03 -0500, Joe Toth wrote: > > It worked, thanks...and I kinda understand why because it attempts to > > singularize the name and it thinks campus is a plural. But why? I > > already added the irregular inflection, shouldn''t it detect its > > already singular? > > inflect.irregular ''campus'', ''campuses'' teaches it this: > > singular: campus. plural: campuses. > > The paginate line is seeing :campus as a plural, and wants to thus > singularize it as campu. > > I did something similar, you could try this to get around the > campus->campu issue, though it might be better to leave it erroring and > use Jonathan''s correct fix. > > inflect.singular /^(campus)es/i, ''\1'' > > - Jamie > > > Thanks > > > > On 11/4/05, Jonathan Younger <daikini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Change: > > > @campus_pages, @campuses = paginate :campus, :per_page => 10 > > > > > > To: > > > @campus_pages, @campuses = paginate :campuses, :per_page => 10 > > > > > > -Jonathan > > > > > > On Nov 4, 2005, at 12:52 PM, Joe Toth wrote: > > > > > > > Oddly enough I''m having a similar problem... > > > > > > > > I''ve added inflect.irregular ''campus'', ''campuses'' under to > > > > environment.rb > > > > > > > > I am getting the error: "uninitialized constant Campu" > > > > from line reading: @campus_pages, @campuses > > > > paginate :campus, :per_page => 10 > > > > > > > > Its like it thinks I''m telling it "campu" plural is "campuses" > > > > > > > > Any ideas? > > > > > > > > On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >> You will need to add the campus pluralization rules to > > > >> config/environment.rb. Find the section that looks like this: > > > >> > > > >> # Add new inflection rules using the following format > > > >> # (all these examples are active by default): > > > >> # Inflector.inflections do |inflect| > > > >> # inflect.plural /^(ox)$/i, ''\1en'' > > > >> # inflect.singular /^(ox)en/i, ''\1'' > > > >> # inflect.irregular ''person'', ''people'' > > > >> # inflect.uncountable %w( fish sheep ) > > > >> # end > > > >> > > > >> The easiest way is to do this: > > > >> > > > >> Inflector.inflections do |inflect| > > > >> inflect.irregular ''campus'', ''campuses'' > > > >> end > > > >> > > > >> -Lee > > > >> > > > >> On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >>> Hi, > > > >>> > > > >>> I have a table named campuses, and if I try to generate the > > > >>> scaffold, I > > > >>> get this error after edit.rhtml: > > > >>> > > > >>> Before updating scaffolding from new DB schema, try creating a > > > >>> table for > > > >>> your model (Campus). > > > >>> > > > >>> The command I used was: ruby script\generate scaffold Campus > > > >>> Campuses > > > >>> > > > >>> Can someone help me out? > > > >>> > > > >>> Thanks! > > > >>> > > > >>> - Ivan V. > > > >>> > > > >>> _______________________________________________ > > > >>> Rails mailing list > > > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > > > >>> > > > >> _______________________________________________ > > > >> Rails mailing list > > > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > >> > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thank you all! I actually changed the table name, but it''s good to know the answer in case something similar arises later! Thanks again. Ivan V. Jamie Macey wrote:> My bad. the inflection at the end should be: > > inflect.singular /^(campus)(es)?/i, ''\1'' > > - Jamie > > On Fri, 2005-04-11 at 17:28 -0800, Jamie Macey wrote: > >> On Fri, 2005-04-11 at 16:03 -0500, Joe Toth wrote: >> >>> It worked, thanks...and I kinda understand why because it attempts to >>> singularize the name and it thinks campus is a plural. But why? I >>> already added the irregular inflection, shouldn''t it detect its >>> already singular? >>> >> inflect.irregular ''campus'', ''campuses'' teaches it this: >> >> singular: campus. plural: campuses. >> >> The paginate line is seeing :campus as a plural, and wants to thus >> singularize it as campu. >> >> I did something similar, you could try this to get around the >> campus->campu issue, though it might be better to leave it erroring and >> use Jonathan''s correct fix. >> >> inflect.singular /^(campus)es/i, ''\1'' >> >> - Jamie >> >> >>> Thanks >>> >>> On 11/4/05, Jonathan Younger <daikini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>>> Change: >>>> @campus_pages, @campuses = paginate :campus, :per_page => 10 >>>> >>>> To: >>>> @campus_pages, @campuses = paginate :campuses, :per_page => 10 >>>> >>>> -Jonathan >>>> >>>> On Nov 4, 2005, at 12:52 PM, Joe Toth wrote: >>>> >>>> >>>>> Oddly enough I''m having a similar problem... >>>>> >>>>> I''ve added inflect.irregular ''campus'', ''campuses'' under to >>>>> environment.rb >>>>> >>>>> I am getting the error: "uninitialized constant Campu" >>>>> from line reading: @campus_pages, @campuses >>>>> paginate :campus, :per_page => 10 >>>>> >>>>> Its like it thinks I''m telling it "campu" plural is "campuses" >>>>> >>>>> Any ideas? >>>>> >>>>> On 11/4/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>> >>>>>> You will need to add the campus pluralization rules to >>>>>> config/environment.rb. Find the section that looks like this: >>>>>> >>>>>> # Add new inflection rules using the following format >>>>>> # (all these examples are active by default): >>>>>> # Inflector.inflections do |inflect| >>>>>> # inflect.plural /^(ox)$/i, ''\1en'' >>>>>> # inflect.singular /^(ox)en/i, ''\1'' >>>>>> # inflect.irregular ''person'', ''people'' >>>>>> # inflect.uncountable %w( fish sheep ) >>>>>> # end >>>>>> >>>>>> The easiest way is to do this: >>>>>> >>>>>> Inflector.inflections do |inflect| >>>>>> inflect.irregular ''campus'', ''campuses'' >>>>>> end >>>>>> >>>>>> -Lee >>>>>> >>>>>> On 11/3/05, i.v.r. <ivanvega-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I have a table named campuses, and if I try to generate the >>>>>>> scaffold, I >>>>>>> get this error after edit.rhtml: >>>>>>> >>>>>>> Before updating scaffolding from new DB schema, try creating a >>>>>>> table for >>>>>>> your model (Campus). >>>>>>> >>>>>>> The command I used was: ruby script\generate scaffold Campus >>>>>>> Campuses >>>>>>> >>>>>>> Can someone help me out? >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> - Ivan V. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rails mailing list >>>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Rails mailing list >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >