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

18 lines
445 B
Ruby

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