Company belongs_to Users and a Company has_many Quotes. If a User is logged_in, and has a company created in the db, I would like to root to Quotes#new, which requires the company_id to be passed in. I can't seem to pass an argument into the root call, could you advise how I could achieve, a) a conditional root based upon logged in status and b) routing to a nested controller that requires parent id to be passed.
both:
root 'quotes#new', company_id: company.id
and:
root 'quotes#new', current_user
result in Couldn't find Company with 'id'=
Thanks.
Info I'm finding to help me with this:
http://minhajuddin.com/2011/10/24/how-to-change-the-rails-root-url-based-on-the-user-or-role/
Rails Routes based on condition
http://bjedrocha.com/rails/2015/03/18/role-based-routing-in-rails/