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

**URL:** <https://www.ruby-forum.com/t/mysql-42s02table-galleriamacondo-development-media-doesnt-exist-select-from-media/145941>\
**Category:** Rails\
**Created:** [August 15, 2008, 10:34am UTC](https://www.ruby-forum.com/t/mysql-42s02table-galleriamacondo-development-media-doesnt-exist-select-from-media/145941 "2008-08-15T10:34:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Memo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a5b964/32.png) [@Memo](https://www.ruby-forum.com/u/Memo)\
**Post date:** [August 15, 2008, 10:34am UTC](https://www.ruby-forum.com/t/mysql-42s02table-galleriamacondo-development-media-doesnt-exist-select-from-media/145941/1 "2008-08-15T10:34:14Z")

</div>

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:in`execute’  
/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:in`select\_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:in`cache\_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:in`find\_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:in`find’  
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:in`send’  
/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:in`call\_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:in`perform\_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:in`perform\_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:in`perform\_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:in`cache’  
/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:in`send’  
/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:in`process\_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:in`process’  
/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:in`dispatch’  
/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:in`dispatch’  
/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:in`synchronize’  
/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:in`process\_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:in`process\_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:in`initialize’  
/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:in`run’  
/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:in`new’  
/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: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: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:in`run’  
/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:in`run’  
/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

---

<div class="post-metadata">

**Author:** ![Memo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a5b964/32.png) [@Memo](https://www.ruby-forum.com/u/Memo)\
**Post date:** [August 15, 2008, 10:38am UTC](https://www.ruby-forum.com/t/mysql-42s02table-galleriamacondo-development-media-doesnt-exist-select-from-media/145941/2 "2008-08-15T10:38:58Z")

</div>

On Aug 15, 12:16 am, Memo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
