开发者

Deploying app to Heroku with complex forms

I have an application that works great on my laptop (Ubuntu 10.4), passes all of my tests, but fails spectacularly when I push it to Heroku. The issue is that I have several views that use complex forms to gather data from the user and none of these fields are showing up on Heroku. I have an exam object - which belongs to a user - that has_many questions. And the forms that are not showing up are where the user can answer those questions. Any tips or tricks about debugging on Heroku would be greatly appreciated.

Here are the models I'm working with:

exam.rb

class Exam < ActiveRecord::Base
    belongs_to :user
    has_many   :questions
    accepts_nested_attributes_f开发者_Python百科or :questions

question.rb

class Question < ActiveRecord::Base
    belongs_to :exam

form.html.erb

<% form_for @exam, :url => put_part1_exam_path(@exam) do |exam_form| %>
    <%= exam_form.fields_for :questions do |question| %>
      <p>
        Value: <%= question.text_field :given_value %>
        <%= question.object.phrase %>
      </p>
    <% end %>
  <p>
    <%= submit_tag "Continue" %>
  </p>
<% end %>


Well, the answer was rather simple. The problem was between the chair and the keyboard. I had forgotten to run the rake db:seed task that would put information into the database that would be displayed in the form. I ran that task and the problem is solved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜