Ошибка:
undefined method `attribute_methods_generated?' for nil:NilClass
Код является простым для разрешения кому-либо зарегистрироваться.В контроллере создается объект @tutor.Всякий раз, когда я удаляю form_for, страница загружается нормально, но, кажется, ничто иное не может это исправить.
Код:
<% form_for(@tutor) do |f| %>
<table class="form_table" id="home_form">
<tr>
<td>First Name:</td>
<td class="form">
<%= f.text_field :fname, :class => 'form', :size => 30 %>
</td>
</tr>
<tr>
<td>Last Name:</td>
<td class="form">
<%= f.text_field :lname, :class => 'form', :size => 30 %>
</td>
</tr>
<tr>
<td>Email:</td>
<td class="form">
<%= f.text_field :email, :class => 'form', :size => 30 %>
</td>
</tr>
<tr>
<td>Password:</td>
<td class="form">
<%= f.password_field :password, :class => 'form', :size => 20 %>
</td>
</tr>
]
<td> </td>
<td>
<div align="left">
<%= f.hidden_field :branch_id, :value => @branch.id.to_s %>
<%= f.submit 'Submit', :class => 'submit', :style => 'margin-left:3px;' %>
</div>
</td>
</tr>
</table>
<% end %>
Вот трассировка стека:
activesupport (3.0.10) lib/active_support/whiny_nil.rb:48:in `method_missing'
activerecord (3.0.10) lib/active_record/attribute_methods.rb:51:in `respond_to?'
actionpack (3.0.10) lib/action_view/helpers/form_helper.rb:329:in `apply_form_for_options!'
actionpack (3.0.10) lib/action_view/helpers/form_helper.rb:313:in `form_for'
app/views/tutors/register.html.erb:3:in `_app_views_tutors_register_html_erb__142383781_2257394860_0'
actionpack (3.0.10) lib/action_view/template.rb:135:in `send'
actionpack (3.0.10) lib/action_view/template.rb:135:in `render'
activesupport (3.0.10) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.10) lib/action_view/template.rb:127:in `render'
actionpack (3.0.10) lib/action_view/render/rendering.rb:59:in `_render_template'
activesupport (3.0.10) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.10) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.10) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.10) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.10) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.10) lib/abstract_controller/rendering.rb:115:in `_render_template'
actionpack (3.0.10) lib/abstract_controller/rendering.rb:109:in `render_to_body'
actionpack (3.0.10) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.10) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.10) lib/abstract_controller/rendering.rb:102:in `render_to_string'
Ивот класс репетитора:
class Tutor < ActiveRecord::Base
belongs_to :branch
end