ADD: picture to themengruppe
This commit is contained in:
@@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
class Themengruppe < ActiveRecord::Base
|
class Themengruppe < ActiveRecord::Base
|
||||||
WORD_COUNT = 50
|
WORD_COUNT = 50
|
||||||
attr_accessible :text, :title
|
attr_accessible :text, :title, :picture
|
||||||
has_many :themen, class_name: 'Thema'
|
has_many :themen, class_name: 'Thema'
|
||||||
has_many :fragen, through: :themen
|
has_many :fragen, through: :themen
|
||||||
|
mount_uploader :picture, PictureUploader
|
||||||
|
|
||||||
validates :title, :presence => true
|
validates :title, :presence => true
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<%= semantic_form_for @thema do |f| %>
|
<%= semantic_form_for @thema do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
<%= f.input :title %>
|
<%= f.input :title %>
|
||||||
|
<%= f.input :picture, :as => :file %>
|
||||||
<%= f.input :themengruppe %>
|
<%= f.input :themengruppe %>
|
||||||
<%= f.input :text, :as=>:tinymce_text%>
|
<%= f.input :text, :as=>:tinymce_text%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<%= semantic_form_for @themengruppe do |f| %>
|
<%= semantic_form_for @themengruppe do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
<%= f.input :title %>
|
<%= f.input :title %>
|
||||||
|
<%= f.input :picture, :as => :file %>
|
||||||
<%= f.input :text %>
|
<%= f.input :text %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
|
|||||||
5
db/migrate/20130823105422_add_picture_to_themengruppe.rb
Normal file
5
db/migrate/20130823105422_add_picture_to_themengruppe.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddPictureToThemengruppe < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :themengruppen, :picture, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user