当我在添加表单字段后尝试在我的应用中查看页面时,我在状态#new 中收到此错误 NoMethodError ...我是新手ruby on rails所以我很想知道能够完全理解这一点......
<%= f.input :user_id %>
以下是完整的错误消息:
NoMethodError in Statuses#new
Showing /Users/danlee/Projects/treebook/app/views/statuses/_form.html.erb where line #14 raised:
undefined method `user_id' for #<Status:0x007feb53cdd138>
Extracted source (around line #14):
11: </div>
12: <% end %>
13:
14: <%= f.input :user_id %>
15: <%= f.input :content %>
16: <div class="form-actions">
17: <%= f.button :submit %>
Trace of template inclusion: app/views/statuses/new.html.erb
Rails.root: /Users/danlee/Projects/treebook
Application Trace | Framework Trace | Full Trace
app/views/statuses/_form.html.erb:14:in `block in _app_views_statuses__form_html_erb__4012047659275744874_70324335923840'
app/views/statuses/_form.html.erb:1:in `_app_views_statuses__form_html_erb__4012047659275744874_70324335923840'
app/views/statuses/new.html.erb:3:in `_app_views_statuses_new_html_erb___64465850179705865_70324349236340'
app/controllers/statuses_controller.rb:29:in `new'
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None
应用程序的Github存储库也在这里:https://github.com/pixeljugglerdan/treebook