diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index 7cee6f8..ef59efd 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -11,9 +11,10 @@ class Themengruppe < ActiveRecord::Base WORD_COUNT = 50 - attr_accessible :text, :title + attr_accessible :text, :title, :picture has_many :themen, class_name: 'Thema' has_many :fragen, through: :themen + mount_uploader :picture, PictureUploader validates :title, :presence => true diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 0444d68..53e9944 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -2,6 +2,7 @@ <%= semantic_form_for @thema do |f| %> <%= f.inputs do %> <%= f.input :title %> + <%= f.input :picture, :as => :file %> <%= f.input :themengruppe %> <%= f.input :text, :as=>:tinymce_text%> <% end %> diff --git a/app/views/themengruppen/_form.html.erb b/app/views/themengruppen/_form.html.erb index c81d3ff..783961e 100644 --- a/app/views/themengruppen/_form.html.erb +++ b/app/views/themengruppen/_form.html.erb @@ -1,7 +1,9 @@ <%= semantic_form_for @themengruppe do |f| %> <%= f.inputs do %> <%= f.input :title %> + <%= f.input :picture, :as => :file %> <%= f.input :text %> + <% end %> <%= f.actions do %> diff --git a/db/migrate/20130823105422_add_picture_to_themengruppe.rb b/db/migrate/20130823105422_add_picture_to_themengruppe.rb new file mode 100644 index 0000000..392c8b3 --- /dev/null +++ b/db/migrate/20130823105422_add_picture_to_themengruppe.rb @@ -0,0 +1,5 @@ +class AddPictureToThemengruppe < ActiveRecord::Migration + def change + add_column :themengruppen, :picture, :string + end +end