I am attempting to generate scaffolds on legacy tables that have underscores in the name. Scaffold does not see the underscore. I have tried a backslash escape but it no work. I have looked around but i cannot find a way to make it work. It''s like this: c:\railroad>ruby script/generate scaffold FOO_BAR exists app/controllers/ exists app/helpers/ create app/views/foobar exists test/functional/ dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/foobar.rb identical test/unit/foobar_test.rb identical test/fixtures/foobar.yml ORA-04043: object foobar does not exist You see?? Can you help?? Thank you- damon -- Posted via http://www.ruby-forum.com/.
> c:\railroad>ruby script/generate scaffold FOO_BARTry: ruby script/generate scaffold FooBar And then in your foo_bar.rb model file: class FooBar < AR::Base set_table_name ''FOO_BAR'' end There are other class methods on ActiveRecord::Base you might need to call for your legacy table. http://api.rubyonrails.com/classes/ActiveRecord/Base.html -- Posted via http://www.ruby-forum.com/.
Dr Nic wrote:>> c:\railroad>ruby script/generate scaffold FOO_BAR... Thanx Doc The set table name did not work. I was able to generate a scaffold for a table that did not have the underscore char on the same DB. I tried to duplicate the app/** files created by that scaffold using the name of the table with the underscore and appropriate column names in the form view. No love. I think i am going to have to live without the convinience of scaffold and set it all up manually through active record. I was hoping there was a regex or some escape at the command line that would allow me to input that underscore on the call to the generate method with scaffold. Nice forum, love the response time!! damon -- Posted via http://www.ruby-forum.com/.