I have access to current_user in model ?
def classroom_params params.require(:classroom).permit(:name, :owner_id => [current_user]) end
But don't work because "owner.required".
You don't have access to that in the model. For assigning current_user, I do that in the controller but all other defaults I'd put in the model.
def create @record = Record.new(record_params) @record.owner = current_user if @record.save #... etc end
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.