announcement-test/app/controllers/admin/announcements_controller.rb

22 lines
498 B
Ruby
Raw Normal View History

2014-04-03 03:18:02 +00:00
class Admin::AnnouncementsController < ApplicationController
def new
@announcement = Bulletin.new
end
def create
@announcement = Bulletin.new(bulletin_params)
@announcement.save
end
2014-04-10 03:52:59 +00:00
def index
@announcements = Bulletin.all
end
2014-04-03 03:18:02 +00:00
private
# Never trust parameters from the scary internet, only allow the white list through.
def bulletin_params
params.require(:bulletin).permit(title_translations: [:en, :zh_tw], body_translations: [:en, :zh_tw])
end
end