I have the following models in my app
class User < ActiveRecord::Base
has_many :articles
has_many :tour_companies
has_many :accomodations
end
class Articles < ActiveRecord::Base
belongs_to :user
belongs_to :bloggable, :polymorphic => true
end
class TourCompany < ActiveRecord::Base
belongs_to :user
has_many :articles, :as => :bloggable
end
class Accommodation < ActiveRecord::Base
belongs_to :user
has_many :articles, :as => :bloggable
end
Now my problem is i want a logged in user to be able to write an article and use a form collection_select to select which one of his / her tour companies or accommodations the article should be associated with, how do i do it in rails 4? how do i select bloggable type and id from form collection select? I don't want nested resource
&
. What a great trick! – Shellfish