I''m trying to create an "Inventory" application that has two models: 1- item 2- itemdetails I have made a "relationship" between those two models, such that: item has_many itemdetails Once I try to create an item or itemdetail I get a NoMethodError as follows: http://pastie.org/private/wvqtorzl12vrkrudzc8ha This also applies if I wnt to "show". The weird thing aslo is that when I get the NoMethodError page after I add an item gets created, I find that I get a message that the item hs been cteated succssfully. And, attached are the files to show what I hav e did? Any ideas on this? Thanks a lot. Attachments: http://www.ruby-forum.com/attachment/4858/files.zip -- 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 Fri, Jul 16, 2010 at 1:08 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m trying to create an "Inventory" application that has two models: > > 1- item > 2- itemdetails > > I have made a "relationship" between those two models, such that: > > item has_many itemdetails > > Once I try to create an item or itemdetail I get a NoMethodError as > follows: http://pastie.org/private/wvqtorzl12vrkrudzc8ha > > This also applies if I wnt to "show". > > The weird thing aslo is that when I get the NoMethodError page after I > add an item gets created, I find that I get a message that the item hs > been cteated succssfully. > > And, attached are the files to show what I hav e did? > > Any ideas on this? >Have you run all your migrations? Do you have the price column in your itemdetails table? -- Leonardo Mateo. There''s no place like ~ -- 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.
Leonardo Mateo wrote:> On Fri, Jul 16, 2010 at 1:08 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> follows: http://pastie.org/private/wvqtorzl12vrkrudzc8ha >> > Have you run all your migrations? Do you have the price column in your > itemdetails table? > > > -- > Leonardo Mateo. > There''s no place like ~Thanks Leonardo. I have included "price" when generating the scaffold. When I checked the "itemdetails" table using SQLite Manager, the price in addition to other fields are not presented as columns, but, there is ONE column presented :-| You can even see the fields presented in the show.html.erb og itemdetail attached. I also made a rake db:migrate Why aren''t those fields present in the table? What do you think I should do now? Thanks. -- 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.
Does sequence have to do here? I mean, if I create the scaffold "item", must I IMMEDIATELY rake db:migrate BEFORE creating the scaffold "itemdetails"? In my tables, I can see that the "items" table has the required fields, but "itemdetails". You know the story :-) Thanks. -- 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 Fri, Jul 16, 2010 at 1:31 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Leonardo Mateo wrote: >> On Fri, Jul 16, 2010 at 1:08 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> >> wrote: >>> follows: http://pastie.org/private/wvqtorzl12vrkrudzc8ha >>> >> Have you run all your migrations? Do you have the price column in your >> itemdetails table? >> >> >> -- >> Leonardo Mateo. >> There''s no place like ~ > > Thanks Leonardo. > > I have included "price" when generating the scaffold. When I checked the > "itemdetails" table using SQLite Manager, the price in addition to other > fields are not presented as columns, but, there is ONE column presented > :-| > > You can even see the fields presented in the show.html.erb og itemdetail > attached. > > I also made a rake db:migrate > > Why aren''t those fields present in the table?Maybe there was something wrong with your migration generated file> > What do you think I should do now?Check the migration file created for the itemdetails scaffold, fix it and re-do that migration with rake db:migrate:redo VERSION=YOUR_MIGRATION_VERSION_NUMBER_HERE If you want to start fresh, just re-create the scaffold and make sure all the fields are created properly. You can also generate a new migration to add the missing fields to this table, but I wouldn''t recommend this for clarity sake. Hope it helps. -- Leonardo Mateo. There''s no place like ~ -- 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 Fri, Jul 16, 2010 at 1:35 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Does sequence have to do here? > > I mean, if I create the scaffold "item", must I IMMEDIATELY rake > db:migrate BEFORE creating the scaffold "itemdetails"?No, no need to.> > In my tables, I can see that the "items" table has the required fields, > but "itemdetails". You know the story :-) > > Thanks. > -- > 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. > >-- Leonardo Mateo. There''s no place like ~ -- 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.
Thanks Leonardo. Just a small question since I''m nearly new to Rails. What is the "migration file" called? -- 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.
Leonardo Mateo wrote:> On Fri, Jul 16, 2010 at 1:35 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> Does sequence have to do here? >> >> I mean, if I create the scaffold "item", must I IMMEDIATELY rake >> db:migrate BEFORE creating the scaffold "itemdetails"? > No, no need to. > >> 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. >> >> > > > > -- > Leonardo Mateo. > There''s no place like ~Leonardo. Seems I may go with creating it from scratch again. But, till now, don''t know what I have been missing for a column to show up and other not. :-| Thanks. -- 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.
I think I figured what the issue was. I was assigning the type "double" instead of writing it as "decimal" :-) WAS ---> price:double NOW ---> price:decimal ---> Worked -- 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 Sat, Jul 17, 2010 at 12:36 PM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I think I figured what the issue was. I was assigning the type "double" > instead of writing it as "decimal" :-) > > WAS ---> price:double > NOW ---> price:decimal ---> WorkedThere you go. Sorry for the late. To find the migration files you should look at the db/migrate directory, there you''ll find those files named with the version number (which is actually a timestamp) , followed by a relevant name about what they do. For example, your itemdetails scaffold migration file, might be named something like this: 20100717192542_create_itemdetails.rb Hope it helps. Cheers. -- Leonardo Mateo. There''s no place like ~ -- 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.
Thanks a lot. -- 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.