# Tax a reserved word?

**URL:** <https://www.ruby-forum.com/t/tax-a-reserved-word/63228>\
**Category:** Rails\
**Created:** [June 13, 2006, 11:21am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228 "2006-06-13T11:21:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:21am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/1 "2006-06-13T11:21:29Z")

</div>

Is tax a reserved word or am I sleep deprived??

I’m working on a shopping cart and have a table called sales\_taxes (at  
first i named it taxes).  
I get the following error when i load the controller:

uninitialized constant SalesTaxis

RAILS\_ROOT: script/…/config/…  
Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:123:in  
`const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in`const\_missing’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/inflector.rb:161:in  
`constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in`constantize’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/pagination.rb:194:in  
`paginator_and_collection_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in`paginate’  
#{RAILS\_ROOT}/app/controllers/admin/sales\_taxes\_controller.rb:12:in  
`list’

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:123:in  
`const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in`const\_missing’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/inflector.rb:161:in  
`constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in`constantize’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/pagination.rb:194:in  
`paginator_and_collection_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in`paginate’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:910:in  
`perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in`perform\_action\_without\_benchmark’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in`perform\_action’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:381:in  
`process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in`process\_without\_session\_management\_support’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/session\_management.rb:117:in  
`process' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in`dispatch’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:115:in  
`handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in`service’  
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in`start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in`start’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:67:in  
`dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in`require’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in`require’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require’  
script/server:3

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:123:in  
`const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in`const\_missing’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/inflector.rb:161:in  
`constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in`constantize’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/pagination.rb:194:in  
`paginator_and_collection_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in`paginate’  
#{RAILS\_ROOT}/app/controllers/admin/sales\_taxes\_controller.rb:12:in  
`list' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in`perform\_action\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/filters.rb:368:in  
`perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/rescue.rb:82:in  
`perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in`process\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/filters.rb:377:in  
`process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in  
`dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in`handle\_dispatch’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick\_server.rb:81:in  
`service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in`service’  
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in`start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in`start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in`dispatch’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in`require’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in`require’  
script/server:3

This error occured while loading the following files:  
sales\_taxis.rb

I have no “taxis” anywhere in my code. I’ve even done a project search  
in textmate trying to find it. Here’s my list action:

def list  
@sales\_tax\_pages, @sales\_taxes = paginate :sales\_taxes, :per\_page =\>  
10  
end

I must be nuts or have a ghost in the machine.

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:28am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/2 "2006-06-13T11:28:07Z")

</div>

Hi –

On Tue, 13 Jun 2006, Greg N. wrote:

> Is tax a reserved word or am I sleep deprived??
> 
> I’m working on a shopping cart and have a table called sales\_taxes (at  
> first i named it taxes).  
> I get the following error when i load the controller:
> 
> uninitialized constant SalesTaxis  
> […]
> 
> This error occured while loading the following files:  
> sales\_taxis.rb

Rename the file 🙂

David

–  
David A. Black (removed\_email\_address@domain.invalid)  
Ruby Power and Light, LLC ([http://www.rubypowerandlight.com](http://www.rubypowerandlight.com))

See what the readers are saying about “Ruby for Rails”!

> **[Ruby on Rails Framework | Ruby Power and Light](https://www.rubypowerandlight.com/)**
>
> Main aspects of the Ruby language with focus on Rails - the most widespread and powerful Web Application Framework of the language, which implements the MVC pattern.

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:28am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/3 "2006-06-13T11:28:38Z")

</div>

It could be that you’re trying to use SalesTaxis instead of SalesTaxes  
:0)

Steve

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:34am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/4 "2006-06-13T11:34:56Z")

</div>

I am not using SalesTaxis at all, that’s what’s so baffling.

I also did rename the file. It was originally named taxes, and it  
returned an error just like this one did, but taxes was coming up taxis.

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:44am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/5 "2006-06-13T11:44:01Z")

</div>

David M. wrote:

> My guess is that Rails is (incorrectly) working out that “Sales\_Taxes”  
> is the plural of “Sales\_Taxis”.
> 
> Interesting bug, if that’s the case - I’m surprised no-one’s spotted  
> it before. Hopefully you’ll be able to work around it by specifying  
> the table name in the model.
> 
> Regards
> 
> Dave M.

Assuming it is a bug, how do I specify a table name in the model? Or  
maybe i should simply rename the table to taxis and see if it reverses  
it. haha

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:55am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/6 "2006-06-13T11:55:30Z")

</div>

> Hopefully you’ll be able to work around it by specifying  
> the table name in the model.

It might be better to add tax/taxes to the inflections in  
environment.rb.

Steve

---

<div class="post-metadata">

**Author:** ![gregnewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@gregnewman](https://www.ruby-forum.com/u/gregnewman)\
**Post date:** [June 13, 2006, 11:39am UTC](https://www.ruby-forum.com/t/tax-a-reserved-word/63228/7 "2006-06-13T11:39:37Z")

</div>

My guess is that Rails is (incorrectly) working out that “Sales\_Taxes”  
is the plural of “Sales\_Taxis”.

Interesting bug, if that’s the case - I’m surprised no-one’s spotted  
it before. Hopefully you’ll be able to work around it by specifying  
the table name in the model.

Regards

Dave M.
