# Problems occur during production, but not in development

**URL:** <https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679>\
**Category:** Rails\
**Created:** [May 16, 2010, 9:28am UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679 "2010-05-16T09:28:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 16, 2010, 9:28am UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679/1 "2010-05-16T09:28:26Z")

</div>

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:

\<%= f.label :position %\>  
 \<%= f.text\_field :position %\>

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:

  
19: 

20: \<%= f.label :position %\>  
  
21: \<%= f.text\_field :position %\>  
22:

  
23: 

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:

\<%= f.label :category\_id %\>  
 \<%= f.text\_field :category\_id %\>

I just can’t figure out why it won’t work,

Please Help,

Thanks In Advance,

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 16, 2010, 9:38am UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679/2 "2010-05-16T09:38:59Z")

</div>

On 16 May 2010 08:27, Joe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This works fine in production mode, and everything is as it should be.

I guess you meant ok in development.

> 22:
> 
>   
> 23: 
> 
> 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

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 16, 2010, 11:51am UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679/3 "2010-05-16T11:51:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 16, 2010, 11:48am UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679/4 "2010-05-16T11:48:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 16, 2010, 5:02pm UTC](https://www.ruby-forum.com/t/problems-occur-during-production-but-not-in-development/188679/5 "2010-05-16T17:02:39Z")

</div>

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,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
