ruby on rails - Application works in development mode but not in production mode -


i succeed set in place rails server. when i'm trying add new "machine" have error. can see in logs

actionview::templateerror (undefined method `owner_id' #<machine:0x7f85a0d279e0>) on line #49 of app/views/machines/_form.html.erb: 46: </div> 47: <p> 48:    <%= f_machine.label :owner %><br /> 49:    <%= f_machine.collection_select :owner_id, owner.find(:all), :id, :name, :prompt => "select owner"%> 50: </p> 51: <p> 52:    <%= f_machine.label :category %><br />  app/views/machines/_form.html.erb:49 app/views/machines/new.html.erb:4 app/views/machines/new.html.erb:3 app/controllers/machines_controller.rb:35:in `new' passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler' passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application' passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork' passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in `start' passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:222:in `start' passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application' passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application' passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application' passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application' passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop' passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'  rendering /home/et1/wip3/sophia/public/500.html (500 internal server error) 

machine/new

<h1>new machine</h1>  <% form_for(@machine) |f_machine| %>     <%= render :partial => 'form', :locals => { :f_machine => f_machine } %><br /> <p><br /> <%= f_machine.submit 'create' %> </p> <% end %>    <%= link_to 'back', machines_path %> 

machine/_form:

<%= f_machine.error_messages %><br /> <p>     <%= f_machine.label :nom %><br />     <%= f_machine.text_field :nom %> </p> <p> <%= f_machine.label :role %><br /> <select name="machine[role]" title="select role">     <option value="dev">dev</option>     <option value="test">test</option>     <option value="prod">prod</option>     <option value="support">support</option> </select>  </p>  <div class="fields">  <% f_machine.fields_for :ipvfours |f_ip| %>     <%= render :partial => 'ipvfours/form', :locals => { :f_ip => f_ip } %>      <% end %>  <p>     <%= link_to_add_fields "add ipv4 address", f_machine, :ipvfours %> </p>   <% f_machine.fields_for :ipvsixes |f_ip| %>     <%= render 'ipvsixes/form', :f_ip => f_ip %>  <% end %>  <p>     <%= link_to_add_fields "add ipv6 address", f_machine, :ipvsixes %> </p>    <p>     <% f_machine.fields_for :macs |f_ip| %>         <%= render 'macs/form', :f_ip => f_ip %>      <% end %> </p> <p>     <%= link_to_add_fields "add mac address", f_machine, :macs %> </p>  </div> <p>    <%= f_machine.label :owner %><br />    <%= f_machine.collection_select :owner_id, owner.find(:all), :id, :name, :prompt => "select owner"%> </p> <p>    <%= f_machine.label :category %><br />    <%= f_machine.collection_select :category_id, category.find(:all), :id, :cat, :prompt => "select category"%> </p> <br /> 

i don't understand why not work knowing in development mode works.

thanks in advance help.

have migrated database? there owner_id field in machines table in production database?


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -