set_table_name incorrectly parses the passed string when it contains the schema
owner
-------------------------------------------------------------------------------------
Key: JRUBY-2404
URL: http://jira.codehaus.org/browse/JRUBY-2404
Project: JRuby
Issue Type: Bug
Components: ActiveRecord-JDBC
Affects Versions: JRuby 1.1
Environment: Windows XP
JRuby 1.1
activerecord-jdbc-adapter-0.8
Oracle 10g
Reporter: Matthew Williams
When using the following syntax to set a table name on a specific Rails model:
set_table_name "owner.table_or_view_name"
The string is not interpreted correctly and it is stopped at the period.
Here's a real world example with the trace.
class LRU < ActiveRecord::Base
set_table_name "accd.accd_lru_codes_rails_vw"
end
>> @lru = LRU.find(:first)
ActiveRecord::ActiveRecordError: Table ACCD. does not exist
from
C:/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in
`columns_with_ query_cache'
from
C:/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1080:in
`columns'
from
C:/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1093:in
`column_names'
from
C:/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2227:in
`inspect'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:298:in `output_value'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:151:in `eval_input'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:259:in `signal_status'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:147:in `eval_input'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:146:in `eval_input'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:70:in `start'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:69:in `catch'
from C:/jruby-1.1/lib/ruby/1.8/irb.rb:69:in `start'
from C:/jruby-1.1\bin\jirb:19
I can log in with the schema owner and access the view without preceding the
table name with the owner, however, when I have granted SELECT to the user that
my Rails application uses, the view cannot be accessed and adding the owner
name before the view is my last resort to make this view accessible to my Rails
app without having to use the owners login credentials.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email