Reputation: 177
So far I have this for the sorting
sets = Array.new
sets += current_user.experiences.period_end + current_user.educations.period_end
sets.sort! do |current_user.experiences, current_user.educations|
current_user.experiences.period_end <==> current_user.educations.period_end
end
with this for the models
class Experience < ApplicationRecord
attr_accessible :period_end
...
class EducationExperience < ApplicationRecord
attr_accessible :period_end
...
And in the display on HTML I'd like to make an if statement to see if it's an experience or an education experience to change the color of the text.
Upvotes: 0
Views: 44
Reputation: 1920
You don't need to make if statements, just set proper class name to each container respectively. For example (using Slim):
div(class="#{model_name.class.to_s.underscore}")
= model_name.desired_property
Your div will have class experience
or education_experience
respectively and you can adjust styles for them. Cheers
Upvotes: 1