Hey Kostas,
I think this will help you
http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas
Basically, you use:
class Entity < ActiveRecord::Base
set_table_name “entity”
end
Brian
Hey Kostas,
I think this will help you
http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas
Basically, you use:
class Entity < ActiveRecord::Base
set_table_name “entity”
end
Brian
The problem is still that since scaffolding script fails, no rhtml
templates are being produced.
On 3/10/06, Kostas K. [email protected] wrote:
The problem is still that since scaffolding script fails, no rhtml
templates are being produced.
So, what are the error messages then?
–
Kostas K. wrote:
scripts/generate scaffold incident_reported
----> error Before updating scaffolding from new DB schema, try
creating a table for your model (IncidentReported)I think it has to do with rails assuming the table is named
‘incident_reporteds’ which is wrong.
I was asking how i could inform rails’ scaffolding operation that my
table is named ‘incidents_reported’Juan Lupi�n wrote:
if it is really so, it should help to set the table name in the
IncidentReported model:
set_table_name “incidents_reported”
–
Agnieszka F.
scripts/generate scaffold incident_reported
----> error Before updating scaffolding from new DB schema, try
creating a table for your model (IncidentReported)
I think it has to do with rails assuming the table is named
‘incident_reporteds’ which is wrong.
I was asking how i could inform rails’ scaffolding operation that my
table is named ‘incidents_reported’
Juan Lupión wrote:
On Fri, Mar 10, 2006 at 01:22:13PM +0200, Kostas K. wrote:
} scripts/generate scaffold incident_reported
}
} ----> error Before updating scaffolding from new DB schema, try
} creating a table for your model (IncidentReported)
}
} I think it has to do with rails assuming the table is named
} ‘incident_reporteds’ which is wrong.
} I was asking how i could inform rails’ scaffolding operation that my
} table is named ‘incidents_reported’
Toward the end of your config/environment.rb there should be a commented
out section on inflections. You want something like this:
Inflector.inflections do |inflect|
inflect.irregular ‘incident_reported’, ‘incidents_reported’
end
–Greg
Thanks a lot. It worked smoothly
Kostas K. wrote:
Thanks a lot. It worked smoothly
I have same problem with legacy table name and can not figure out how to
make scaffold work
e.g
I have table name ‘ACTIVETASK’ and model ActiveTask
require ‘composite_primary_keys’
class ActiveTask < ActiveRecord::Base
set_table_name :ACTIVETASK
set_primary_keys :id, :site_id
end
my config/environment.rb
…
Inflector.inflections do |inflect|
inflect.irregular ‘ActiveTask’, ‘activetask’
inflect.uncountable ‘ActiveTask’
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs