Problems occur during production, but not in development

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

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

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

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

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!

-Joe

Best,