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

22 lines
498 B
Ruby

class Admin::AnnouncementsController < ApplicationController
def new
@announcement = Bulletin.new
end
def create
@announcement = Bulletin.new(bulletin_params)
@announcement.save
end
def index
@announcements = Bulletin.all
end
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