diff --git a/Dockerfile b/Dockerfile index e07bedc..918a649 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,11 @@ RUN rm /etc/nginx/sites-enabled/default ADD docker/nginx_server.conf /etc/nginx/sites-enabled/parsley.conf ADD docker/nginx_env.conf /etc/nginx/main.d/env.conf +# Add DB Migration Script +RUN mkdir -p /etc/my_init.d +ADD docker/db_migrate.sh /etc/my_init.d/db_migrate.sh +RUN chmod +x /etc/my_init.d/db_migrate.sh + # Set Default RAILS_ENV ENV PASSENGER_APP_ENV docker diff --git a/app/models/recipe.rb b/app/models/recipe.rb index 8c27cd4..7faf4ca 100644 --- a/app/models/recipe.rb +++ b/app/models/recipe.rb @@ -14,6 +14,16 @@ class Recipe < ActiveRecord::Base validates :total_time, numericality: true, allow_blank: true validates :active_time, numericality: true, allow_blank: true + NAME_CUTOFF = 35 + + def display_name + if self.name.length >= NAME_CUTOFF + self.name[0...NAME_CUTOFF] + '...' + else + self.name + end + end + def scale(factor) recipe_ingredients.each do |ri| ri.scale(factor) diff --git a/app/views/recipes/index.html.erb b/app/views/recipes/index.html.erb index cca0435..f6238a7 100644 --- a/app/views/recipes/index.html.erb +++ b/app/views/recipes/index.html.erb @@ -25,7 +25,7 @@
<% @recipes.each do |recipe| %>