I am using 'set_table_name' in all my models, I want one abstract class
which extends from ActiveRecord::Base and all my model should extends
from this abstract class. i will write setter method in abstrct class
which will set table name also i am able to override that method in my
model. my question is this is possible in rails? how to implement this
in rails?
e.g:-
class Abstract < ActiveRecord::Base
def set_table_name(table_name)
return "prefix" + table_name
end
end
class Photo < Abstract
? From here hoe to make a call for set_table_name
end
I am using 'set_table_name' in all my models, I want one abstract class
which extends from ActiveRecord::Base and all my model should extends
from this abstract class. i will write setter method in abstrct class
which will set table name also i am able to override that method in my
model. my question is this is possible in rails? how to implement this
in rails?
If all you want to do is add a prefix, I'd just set
Abstract.table_name_prefix