Let's say for the following actions' controller:
class PostsController < ApplicationController
def create
@post = Post.create(post_params)
end
private
def post_params
params.require(:post).permit(:title, :content)
end
end
Is there a one-line way to do something like this when creating a record :
def create
@post = Post.create(post_params, user_id: current_user.id)
end
What would be the clean way to do it ? Is it possible ?