Hi, Basically I''ve created a system with categories, that belong to tutorials, and these tutorials have positions. I''ve only recently created to new position thing, and I''ve added this to my edit form: <p> <%= f.label :position %><br /> <%= f.text_field :position %> </p> This works fine in production mode, and everything is as it should be. However when I upload it to my actual site (so it goes to production mode) it says an error has occured. And the production log gives out this error: ActionView::TemplateError (undefined method `position'' for #<Tutorial: 0xb752a384>) on line #21 of app/views/tutorials/edit.html.erb: 18: </p> 19: <p> 20: <%= f.label :position %><br /> 21: <%= f.text_field :position %> 22: </p> 23: <p> 24: <%= f.submit ''Update'' %> app/views/tutorials/edit.html.erb:21 app/views/tutorials/edit.html.erb:4 Since it mentions line four, I figured I should show you guys line four as well: <% form_for(@tutorial) do |f| %> I don''t know why it wont work. Everything else that''s like this works, for example the category_id: <p> <%= f.label :category_id %><br /> <%= f.text_field :category_id %> </p> I just can''t figure out why it won''t work, Please Help, Thanks In Advance, Joe -- 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.
Colin Law
2010-May-16 07:37 UTC
Re: Problems occur during production, but not in development
On 16 May 2010 08:27, Joe <joe-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> Hi, > > Basically I''ve created a system with categories, that belong to > tutorials, and these tutorials have positions. > I''ve only recently created to new position thing, and I''ve added this > to my edit form: > > <p> > <%= f.label :position %><br /> > <%= f.text_field :position %> > </p> > > This works fine in production mode, and everything is as it should be.I guess you meant ok in development.> However when I upload it to my actual site (so it goes to production > mode) it says an error has occured. And the production log gives out > this error: > > ActionView::TemplateError (undefined method `position'' for #<Tutorial: > 0xb752a384>) on line #21 of app/views/tutorials/edit.html.erb: > 18: </p> > 19: <p> > 20: <%= f.label :position %><br /> > 21: <%= f.text_field :position %> > 22: </p> > 23: <p> > 24: <%= f.submit ''Update'' %> > > app/views/tutorials/edit.html.erb:21 > app/views/tutorials/edit.html.erb:4Did you remember to run the migration on the production db so that the new column is there? Colin -- 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.
I did mean OK in development. And as for running the migration on production. I wasn''t even aware I could do that. I just run rake db:migrate. How can I run the migration on production? (I''ll be googling while waiting for a reply :P), Thanks for your help, -Joe On May 16, 8:37 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 16 May 2010 08:27, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > Hi, > > > Basically I''ve created a system with categories, that belong to > > tutorials, and these tutorials have positions. > > I''ve only recently created to new position thing, and I''ve added this > > to my edit form: > > > <p> > > <%= f.label :position %><br /> > > <%= f.text_field :position %> > > </p> > > > This works fine in production mode, and everything is as it should be. > > I guess you meant ok in development. > > > > > > > However when I upload it to my actual site (so it goes to production > > mode) it says an error has occured. And the production log gives out > > this error: > > > ActionView::TemplateError (undefined method `position'' for #<Tutorial: > > 0xb752a384>) on line #21 of app/views/tutorials/edit.html.erb: > > 18: </p> > > 19: <p> > > 20: <%= f.label :position %><br /> > > 21: <%= f.text_field :position %> > > 22: </p> > > 23: <p> > > 24: <%= f.submit ''Update'' %> > > > app/views/tutorials/edit.html.erb:21 > > app/views/tutorials/edit.html.erb:4 > > Did you remember to run the migration on the production db so that the > new column is there? > > Colin > > -- > 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 athttp://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.
Ok. Found it out and it works. Thanks for your help, I can''t belive I didn''t even know about migrating in production mode (I remember I had the problem before, but couldnt remember how I fixued it (must have been via this method)). If anyone wants to know how: rake db:migrate RAILS_ENV="production" Thanks so much! -Joe On May 16, 10:47 am, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote:> I did mean OK in development. > > And as for running the migration on production. I wasn''t even aware I > could do that. I just run rake db:migrate. > > How can I run the migration on production? (I''ll be googling while > waiting for a reply :P), > > Thanks for your help, > > -Joe > > On May 16, 8:37 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > > > On 16 May 2010 08:27, Joe <j...-T/oTI28FLjDQXOPxS62xeg@public.gmane.org> wrote: > > > > Hi, > > > > Basically I''ve created a system with categories, that belong to > > > tutorials, and these tutorials have positions. > > > I''ve only recently created to new position thing, and I''ve added this > > > to my edit form: > > > > <p> > > > <%= f.label :position %><br /> > > > <%= f.text_field :position %> > > > </p> > > > > This works fine in production mode, and everything is as it should be. > > > I guess you meant ok in development. > > > > However when I upload it to my actual site (so it goes to production > > > mode) it says an error has occured. And the production log gives out > > > this error: > > > > ActionView::TemplateError (undefined method `position'' for #<Tutorial: > > > 0xb752a384>) on line #21 of app/views/tutorials/edit.html.erb: > > > 18: </p> > > > 19: <p> > > > 20: <%= f.label :position %><br /> > > > 21: <%= f.text_field :position %> > > > 22: </p> > > > 23: <p> > > > 24: <%= f.submit ''Update'' %> > > > > app/views/tutorials/edit.html.erb:21 > > > app/views/tutorials/edit.html.erb:4 > > > Did you remember to run the migration on the production db so that the > > new column is there? > > > Colin > > > -- > > 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 athttp://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 athttp://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.
Marnen Laibow-Koser
2010-May-16 15:02 UTC
Re: Problems occur during production, but not in development
Joe wrote:> Ok. Found it out and it works. > > Thanks for your help, I can''t belive I didn''t even know about > migrating in production mode (I remember I had the problem before, but > couldnt remember how I fixued it (must have been via this method)). > > If anyone wants to know how: rake db:migrate RAILS_ENV="production"Better yet, set up Capistrano, which automates this and most other deployment tasks.> > Thanks so much! > > -JoeBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.