Is this correct

$ rake db:migrate
(in /home/usr/projects/library)
==  CreateBooks: migrating
====================================================
-- create_table(:books)
   -> 0.0236s
==  CreateBooks: migrated (0.0247s)
===========================================

==  CreateSubjects: migrating
=================================================
-- create_table(:subjects)
   -> 0.0099s
==  CreateSubjects: migrated (0.0216s)
========================================

==  TableName: migrating
======================================================
==  TableName: migrated (0.0001s)
=============================================

==  Books: migrating
==========================================================
-- create_table(:books)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'books' already exists: CREATE TABLE `books` (`id`
int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(32)
NOT NULL, `price` float, `subject_id` int(11), `description` text,
`created_at` datetime) ENGINE=InnoDB

(See full trace by running task with --trace)
dar...@wiseflow-desktop:~/projects/library$ sudo rake db:migrate
[sudo] password for darwin:
(in /home/usr/projects/library)
==  Books: migrating
==========================================================
-- create_table(:books)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'books' already exists: CREATE TABLE `books` (`id`
int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(32)
NOT NULL, `price` float, `subject_id` int(11), `description` text,
`created_at` datetime) ENGINE=InnoDB

(See full trace by running task with --trace)


D


On Dec 24, 3:10 pm, Dhruva Sagar <dhruva.sa...@gmail.com> wrote:
> From the logs what appears to me is that you don't have any 'title' field in
> the book database.
>
> Thanks & Regards,
> Dhruva Sagar.
>
> On Thu, Dec 24, 2009 at 12:36 PM, dwhitekiss <dwhitek...@gmail.com> wrote:
> > 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
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to