Below is the code updated for Rails 4.2. Note: the Rails api says that the group_by method is deprecated in Rails, but don't be confused by that, they just mean that you use the Ruby group_by method instead of the Rails' modified version (which no longer exists).
<%@task_months.each do |month, tasks| %><h2><%= month.strftime('%B') %></h2><% tasks.each do |task| %><divclass="task"><strong><%= task.name %></strong>
due on <%= task.due_at.to_date.to_s(:long) %></div><%end%><%end%>
This works as is on Rails 4.2 except for the CSS. Combining other people's advice above the below works for me. Remove .pretty and add a. Change the url from the image folder to the assets folder.
Below is the code updated for Rails 4.2. Note: the Rails api says that the group_by method is deprecated in Rails, but don't be confused by that, they just mean that you use the Ruby group_by method instead of the Rails' modified version (which no longer exists).
This works as is on Rails 4.2 except for the CSS. Combining other people's advice above the below works for me. Remove .pretty and add a. Change the url from the image folder to the assets folder.
You can also use Bootstrap 3 glyphicons instead of background images. Replace the helper method with this and leave out the css classes.
This also works:
self.category = Category.find_or_create_by(name: name) if name.present?