Basically I did STI on User model, and made it working and then removed whatever I did, installed rolify + pundit :-)
Posted in Just sharing: Squash your migrations
I've gone into problem when my test db is using sqlite and I use postgres in prod
Sqlite doesn't have
inet attribute like postgres and I went into some old migration that I don't use anymore.
Clean up your old migrations with https://github.com/jalkoby/squasher
Easy your time on new envs + remove unneccessary create_table, drop_table migrations which happen all the time when we try to implement something
Figured it out. It was the problem that I didn't
permit and sanitized params, even though they were exactly the same in order to
Lets say we have a Company model which accepts_nested_attributes_for User (devise Model)
How do we Save both a company and User model having that a Company has_many :users and a User belongs to a Company???
Users has :confirmable option as well.
so after successful creation of those, we should have company with company_id, a user with company_id as well assigned to him.
Feels I'm getting close
rails g devise User
class Company < User
class Agent < User
application_controller put this:
devise_group :user, contains: [:agent, :company]
so if using confirmable or something, we still can use
Maybe using this one somehow can help?
What if a use case the following:
Generate 1 devise Account model
Create 2 Other Models: User and Member
User and Member both inherit from Account
Member has multiple roles(owner, employee, etc.)
Member is representative of a Company, so when a company signs up,
we Create a Member model + accept nested attributes and build a Company model from there
How to have proper devise routes setup for 2 models and tight them to 1 model? I'm trying to do it without any luck so far.
Chris what do you think of this?
thank you Chris!
Posted in how scrabe data every day
Implement a registration with multiple steps and after all is complete, display "We will approve your application" at the end and wait when an internal admin (only to owners of the app) will approve the account
For implementing admin thing is documented here:
but I can't see good pattern for implementing multi step sign up