Hi,
In a few words, can someone explain to me the NoMethodError. Googling for answers will get you to something but a direct answer from experts will give you something.
NoMethodError in Book#new
Showing app/views/book/new.html.erb where line #4 raised:
undefined method `title' for #<Book id: nil, created_at: nil, updated_at: nil>
Extracted source (around line #4):
1: <h1>Add new book</h1> 2: <%= form_tag :action => 'create' %> 3: <p><label for="book_title">Title</label>: 4: <%= text_field 'book', 'title' %></p> 5: <p><label for="book_price">Price</label>: 6: <%= text_field 'book', 'price' %></p> 7: <p><label for="book_subject">Subject</label>:
RAILS_ROOT: /home/user/projects/library Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ attribute_methods.rb:260:in `method_missing' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/ form_helper.rb:845:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/ form_helper.rb:845:in `value_before_type_cast' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/ form_helper.rb:833:in `value_before_type_cast' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/ form_helper.rb:754:in `to_input_field_tag' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/ form_helper.rb:544:in `text_field' /home/darwin/projects/library/app/views/book/new.html.erb:4:in `_run_erb_app47views47book47new46html46erb' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/ renderable.rb:34:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/ renderable.rb:34:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb: 306:in `with_template' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/ renderable.rb:30:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/ template.rb:205:in `render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb: 265:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:1250:in `render_for_file' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:945:in `render_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ benchmarking.rb:51:in `render' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:10:in `realtime' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ benchmarking.rb:51:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:1326:in `default_render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:1332:in `perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ filters.rb:617:in `call_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ filters.rb:610:in `perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:10:in `realtime' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ rescue.rb:160:in `perform_action_without_flash' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ flash.rb:146:in `perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:532:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:532:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ filters.rb:606:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:391:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ base.rb:386:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ routing/route_set.rb:437:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ dispatcher.rb:87:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ dispatcher.rb:121:in `_call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ dispatcher.rb:130:in `build_middleware_stack' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ connection_adapters/abstract/query_cache.rb:34:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ query_cache.rb:9:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ query_cache.rb:28:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ connection_adapters/abstract/connection_pool.rb:361:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ string_coercion.rb:25:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb: 24:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ params_parser.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ session/cookie_store.rb:93:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ failsafe.rb:26:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ dispatcher.rb:114:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ reloader.rb:34:in `run' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ dispatcher.rb:108:in `call' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb: 17:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb: 13:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb: 50:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb: 14:in `run' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/server:3
D