I want to make it in 1 model... because I save to 1 table...
Put these in Admin and OrdinaryUser sub-classes/sub-models of your
main User model. If you add an STI "type" field to this model then
both these models will still use the users table if you properly
instantiate them.
Thank you…
Your ide must use 3 model… 1 model → User, 1 model → for admin, 1 model → for user
is true?
But I want use 1 model for admin and user…
so if I call “user = User.create” in admin and in user, photo will upload… with different size thumbnail.
Thank you..
Your ide must use 3 model.. 1 model -> User, 1 model -> for admin, 1 model -> for user
is true?
But I want use 1 model for admin and user..
so if I call "user = User.create" in admin and in user, photo will upload.. with different size thumbnail.
Can u explain with code?? thank you very much
class User < ActiveRecord::Base
# Database table "users", having string field "type"
# Put methods common to all users here
end
class OrdinaryUser < User
has_attachment :thumbnails => ...
end
class Admin < User
has_attachment :thumbnails => ...
end