FIX Neuigkeiten New
This commit is contained in:
@@ -27,6 +27,7 @@ class NeuigkeitenController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@neuigkeit = Neuigkeit.new(params[:neuigkeit])
|
@neuigkeit = Neuigkeit.new(params[:neuigkeit])
|
||||||
@rubrik = @neuigkeit.rubrik
|
@rubrik = @neuigkeit.rubrik
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @neuigkeit.save
|
if @neuigkeit.save
|
||||||
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully created.' }
|
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully created.' }
|
||||||
@@ -41,7 +42,7 @@ class NeuigkeitenController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@neuigkeit = Neuigkeit.find(params[:id])
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @neuigkeit.update_attributes(params[:neuigkeit])
|
if @neuigkeit.update_attributes(params[:neuigkeit])
|
||||||
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully updated.' }
|
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully updated.' }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
class Neuigkeit < ActiveRecord::Base
|
class Neuigkeit < ActiveRecord::Base
|
||||||
attr_accessible :datum, :text, :title, :rubrik_id
|
attr_accessible :datum, :text, :title, :rubrik_id, :author_id
|
||||||
belongs_to :author, :class_name =>'User'
|
belongs_to :author, :class_name =>'User'
|
||||||
belongs_to :rubrik, :class_name =>'Rubrik', :foreign_key => "rubrik_id"
|
belongs_to :rubrik, :class_name =>'Rubrik', :foreign_key => "rubrik_id"
|
||||||
validates :rubrik, :presence=>true
|
validates :rubrik, :presence=>true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<h2><%= link_to neuigkeit.title,neuigkeit_path(neuigkeit) %></h2>
|
<h2><%= link_to neuigkeit.title,neuigkeit_path(neuigkeit) %></h2>
|
||||||
<%= if !neuigkeit.author.nil?
|
<%= if !neuigkeit.author.nil?
|
||||||
neuigkeit.author.name
|
neuigkeit.author.email
|
||||||
end %>
|
end %>
|
||||||
<p><%= raw(neuigkeit.text) %></p>
|
<p><%= raw(neuigkeit.text) %></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user