WSzP
2011-Apr-05 11:48 UTC
Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
Hello, I recently updated Rails to 3.0.5. The very same code that worked on 3.0.3 now gives error. The code is: def kategorialista Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s| [s.nev, s.sefuri]} end It is in application_controller.rb with helper_method :kategorialista The error it gives on 3.0.5: SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".* FROM "kategoria" WHERE "kategoria"."elfogadva" = ''t'' ORDER BY nev Obviously there is no such table as kategoria, but there is „kategorias” table in SQLite. The relevant part of the schema, as generated: create_table "kategorias", :force => true do |t| t.string "nev" t.string "leiras" t.boolean "elfogadva", :default => false t.string "sefuri" t.datetime "created_at" t.datetime "updated_at" end Long story short: what was changed, and how to make my code work? And why this is not mentioned in changelogs? Thanks a lot, WSzP -- 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.
Frederick Cheung
2011-Apr-05 12:11 UTC
Re: Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
On Apr 5, 12:48 pm, WSzP <c...-6nYcUAqTnno@public.gmane.org> wrote:> Hello, > I recently updated Rails to 3.0.5. The very same code that worked on > 3.0.3 now gives error. > The code is: > def kategorialista > Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s| > [s.nev, s.sefuri]} > end > > It is in application_controller.rb with > helper_method :kategorialista > > The error it gives on 3.0.5: > SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".* > FROM "kategoria" WHERE "kategoria"."elfogadva" = ''t'' ORDER BY nev > > Obviously there is no such table as kategoria, but there is > „kategorias” table in SQLite. > > The relevant part of the schema, as generated: > > create_table "kategorias", :force => true do |t| > t.string "nev" > t.string "leiras" > t.boolean "elfogadva", :default => false > t.string "sefuri" > t.datetime "created_at" > t.datetime "updated_at" > end > > Long story short: what was changed, and how to make my code work? And > why this is not mentioned in changelogs?Looks like the inflection rules were tweaked leading rails (https:// github.com/rails/rails/commit/e925acb8 ) to think that kategoria is pluralized to kategoria (ie that it''s already a plural, like stadia). The best thing is probably to add an inflection rule to pluralize kategoria to kategorias. Fred> > Thanks a lot, > WSzP-- 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.
WSzP
2011-Apr-05 12:22 UTC
Re: Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
That''s great to know, but please, can you tell me how to add inflection rule? Or how do I explicitly tell Rails to use that specific table? Thanks a lot, Peter On Apr 5, 3:11 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 5, 12:48 pm, WSzP <c...-6nYcUAqTnno@public.gmane.org> wrote: > > > > > > > > > > > Hello, > > I recently updated Rails to 3.0.5. The very same code that worked on > > 3.0.3 now gives error. > > The code is: > > def kategorialista > > Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s| > > [s.nev, s.sefuri]} > > end > > > It is in application_controller.rb with > > helper_method :kategorialista > > > The error it gives on 3.0.5: > > SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".* > > FROM "kategoria" WHERE "kategoria"."elfogadva" = ''t'' ORDER BY nev > > > Obviously there is no such table as kategoria, but there is > > „kategorias” table in SQLite. > > > The relevant part of the schema, as generated: > > > create_table "kategorias", :force => true do |t| > > t.string "nev" > > t.string "leiras" > > t.boolean "elfogadva", :default => false > > t.string "sefuri" > > t.datetime "created_at" > > t.datetime "updated_at" > > end > > > Long story short: what was changed, and how to make my code work? And > > why this is not mentioned in changelogs? > > Looks like the inflection rules were tweaked leading rails (https:// > github.com/rails/rails/commit/e925acb8 ) to think that kategoria is > pluralized to kategoria (ie that it''s already a plural, like stadia). > The best thing is probably to add an inflection rule to pluralize > kategoria to kategorias. > > Fred > > > > > > > > > > > Thanks a lot, > > WSzP-- 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.
Colin Law
2011-Apr-05 12:31 UTC
Re: Re: Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
On 5 April 2011 13:22, WSzP <ctdd-6nYcUAqTnno@public.gmane.org> wrote:> That''s great to know, but please, can you tell me how to add > inflection rule? Or how do I explicitly tell Rails to use that > specific table?Have a look at config/initializers/inflections.rb Google will provide some examples if you cannot work out exactly what to put there. Colin> Thanks a lot, > Peter > > On Apr 5, 3:11 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Apr 5, 12:48 pm, WSzP <c...-6nYcUAqTnno@public.gmane.org> wrote: >> >> >> >> >> >> >> >> >> >> > Hello, >> > I recently updated Rails to 3.0.5. The very same code that worked on >> > 3.0.3 now gives error. >> > The code is: >> > def kategorialista >> > Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s| >> > [s.nev, s.sefuri]} >> > end >> >> > It is in application_controller.rb with >> > helper_method :kategorialista >> >> > The error it gives on 3.0.5: >> > SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".* >> > FROM "kategoria" WHERE "kategoria"."elfogadva" = ''t'' ORDER BY nev >> >> > Obviously there is no such table as kategoria, but there is >> > „kategorias” table in SQLite. >> >> > The relevant part of the schema, as generated: >> >> > create_table "kategorias", :force => true do |t| >> > t.string "nev" >> > t.string "leiras" >> > t.boolean "elfogadva", :default => false >> > t.string "sefuri" >> > t.datetime "created_at" >> > t.datetime "updated_at" >> > end >> >> > Long story short: what was changed, and how to make my code work? And >> > why this is not mentioned in changelogs? >> >> Looks like the inflection rules were tweaked leading rails (https:// >> github.com/rails/rails/commit/e925acb8 ) to think that kategoria is >> pluralized to kategoria (ie that it''s already a plural, like stadia). >> The best thing is probably to add an inflection rule to pluralize >> kategoria to kategorias. >> >> Fred >> >> >> >> >> >> >> >> >> >> > Thanks a lot, >> > WSzP > > -- > 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 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.
WSzP
2011-Apr-05 12:45 UTC
Re: [Solved] Rails 3.0.5 gives SQLite3::SQLException for the same code that works on 3.0.3
Thanks a lot, Colin Law told me the solution. If anyone else has similar problem, the solution was adding: --- ActiveSupport::Inflector.inflections do |inflect| inflect.irregular ''kategoria'', ''kategorias'' end --- to the config/initializers/inflections.rb file. Thanks again. WSzP -- 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.