Bugs item #9189, was opened at 2007-03-11 23:05
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9189&group_id=2014
Category: AR-JDBC
Group: 0.2.3
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: ActiveRecord-JDBC-0.2.3
Initial Comment:
Using Java 1.5 on Windows XP with MySQL and ActiveRecord-JDBC-0.2.3, the
following error is reported.
MODEL
class Product < ActiveRecord::Base
end
MYSQL TABLE
CREATE TABLE `products` (
`id` int(11) NOT NULL auto_increment,
`Title` varchar(25) NOT NULL default '--',
`Description` varchar(25) NOT NULL default '--',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ERROR REPORT
NoMethodError in Products#index
Showing app/views/products/list.rhtml where line #13 raised:
undefined method `Title' for #<Product:0x132a4df
@attributes={"description"=>"Bubble bath", "title"=>"Foamy", "id"=>1}>
Extracted source (around line #13):
10: <% for product in @products %>
11: <tr>
12: <% for column in Product.content_columns %>
13: <td><%=h product.send(column.name) %></td>
14: <% end %>
15: <td><%= link_to 'Show', :action => 'show', :id => product %></td>
16: <td><%= link_to 'Edit', :action => 'edit', :id => product %></td>
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
C:/jruby-0.9.8/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1861:in
`method_missing'
C:/jruby-0.9.8/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1861:in
`method_missing'
#{RAILS_ROOT}/app/views/products/list.rhtml:13:in `send'
#{RAILS_ROOT}/app/views/products/list.rhtml:13:in
`_run_rhtml_47app47views47products47list46rhtml'
#{RAILS_ROOT}/app/views/products/list.rhtml:14:in
`_run_rhtml_47app47views47products47list46rhtml'
#{RAILS_ROOT}/app/views/products/list.rhtml:19:in
`_run_rhtml_47app47views47products47list46rhtml'
app/controllers/products_controller.rb:4:in `measure'
app/controllers/products_controller.rb:4:in `index'
----------------------------------------------------------------------
>Comment By: Ola Bini (olabini)
Date: 2007-08-11 15:23
Message:
Fixed in trunk.
----------------------------------------------------------------------
Comment By: Martin Plöger (martin_ploeger)
Date: 2007-03-11 23:20
Message:
Seems like ActiveRecord-JDBC can't work with uppercase columns.
Try lowercase column-names (you should do this anyway).
But this should maybe be fixed (AR-JDBC should ignore the case of columns),
because Ruby is very sensible with uppercase Methods.
When there is no receiver (like self.Uppercase_method vs. Uppercase_method) it
confuses Constants and methods.
Accessors to columns should definitively be handles as methods, so they should
always be lowercase or treated as lowercase.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9189&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel