added seed data
This commit is contained in:
@@ -12,7 +12,7 @@ class PostsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@post.user = current_user
|
||||
@post.user ||= current_user
|
||||
if @post.save
|
||||
flash[:notice] = "Post was successfully created."
|
||||
redirect_to topic_path(@post.topic)
|
||||
|
||||
@@ -7,7 +7,7 @@ class TopicsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@topic.user = current_user
|
||||
@topic.user ||= current_user
|
||||
|
||||
if @topic.save
|
||||
flash[:notice] = "Topic was successfully created."
|
||||
|
||||
@@ -7,7 +7,7 @@ class Topic < ActiveRecord::Base
|
||||
|
||||
# Accessors
|
||||
attr_accessor :body
|
||||
attr_accessible :title, :body, :sticky, :locked
|
||||
attr_accessible :title, :body, :sticky, :locked, :forum_id
|
||||
|
||||
# Validations
|
||||
validates :title, :presence => true
|
||||
|
||||
Reference in New Issue
Block a user