Skip to content

Instantly share code, notes, and snippets.

@domagude
Last active November 8, 2017 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domagude/5ea79725aac30e31edfdcb17c5526ef6 to your computer and use it in GitHub Desktop.
Save domagude/5ea79725aac30e31edfdcb17c5526ef6 to your computer and use it in GitHub Desktop.
...
def new
@branch = params[:branch]
@categories = Category.where(branch: @branch)
@post = Post.new
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to post_path(@post)
else
redirect_to root_path
end
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment