Mysql::Error: #42S02Table 'galleriamacondo_development.media' doesn't exist: SELECT * FROM `media`

I ran into an error that I can’t quite figure out.

I ran the following command and can’t understand why some files were
changed to start with media instead of medium. I went through and
updated my controller, model, and my views and I’m receiving a error
that the table media does not exist. Can someone help on correcting
this or explaining why it’s changing my name?

MBPro:galleriamacondo Memo$ script/generate scaffold admin/medium
timestamps:datetime name:string
create app/models/admin
exists app/controllers/admin
exists app/helpers/admin
create app/views/admin/media
create app/views/layouts/admin
exists test/functional/admin
exists test/unit/admin
create app/views/admin/media/index.html.erb
create app/views/admin/media/show.html.erb
create app/views/admin/media/new.html.erb
create app/views/admin/media/edit.html.erb
create app/views/layouts/admin/media.html.erb
identical public/stylesheets/scaffold.css
dependency model
exists app/models/admin
exists test/unit/admin
exists test/fixtures/admin
create app/models/admin/medium.rb
create test/unit/admin/medium_test.rb
create test/fixtures/admin_media.yml
exists db/migrate
create db/migrate/004_create_admin_media.rb
create app/controllers/admin/media_controller.rb
create test/functional/admin/media_controller_test.rb
create app/helpers/admin/media_helper.rb
route map.resources :media
Loaded suite script/generate
Started

Finished in 0.000145 seconds.

ERROR FROM WEBSITE****
sql::Error: #42S02Table ‘galleriamacondo_development.media’ doesn’t
exist: SELECT * FROM media
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract_adapter.rb:150:in log' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/mysql_adapter.rb:281:inexecute’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/mysql_adapter.rb:481:in select' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/database_statements.rb:7:inselect_all_without_query_cache’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:53:in select_all' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/query_cache.rb:74:incache_sql’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:53:in select_all' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:532:infind_by_sql’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
base.rb:1233:in find_every' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:503:infind’
app/controllers/admin/medium_controller.rb:8:in index' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:1158:insend’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:1158:in perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:697:incall_filters’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:689:in perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ benchmarking.rb:68:inperform_action_without_rescue’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/benchmark.rb:293:in measure' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ benchmarking.rb:68:inperform_action_without_rescue’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
rescue.rb:199:in perform_action_without_caching' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ caching.rb:678:inperform_action’
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:33:in cache' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ query_cache.rb:8:incache’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
caching.rb:677:in perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:524:insend’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:524:in process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:685:inprocess_without_session_management_support’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session_management.rb:123:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:388:inprocess’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:171:in handle_request' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:115:indispatch’
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:126:in dispatch_cgi' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:9:indispatch’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:76:in process' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:74:insynchronize’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:74:in process' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:inprocess_client’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:inprocess_client’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:ininitialize’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:inrun’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:innew’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:inrun’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:inrun’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:in run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:inrun’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19:in `load’
/usr/bin/mongrel_rails:19

On Aug 15, 12:16 am, Memo [email protected] wrote:

I ran into an error that I can’t quite figure out.

I ran the following command and can’t understand why some files were
changed to start with media instead of medium. I went through and
updated my controller, model, and my views and I’m receiving a error
that the table media does not exist. Can someone help on correcting
this or explaining why it’s changing my name?

There’s an obvious question, does the table exist? The controller was
called media because rails pluralized the model name. You may have
confused rails if you’ve gone and changed all that stuff behind its
back.
You’ve also ended up with namespaced models, which have all kinds of
pitfalls.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs