Action Controller
Action Controller is C in the Rails model-view-controller code architecture.
Example: An action called articles#change_book
def change_book @target_book = current_user.books.find_by(id: params[:book_id]) if !@target_book head :unprocessable_entity elsif @target_book == @book head :ok else # TODO: This has a bug I'm pretty sure where it can leave the ordinal positions # in a state that it needs to be fixed by the FixOrdinalPositionsJob @book.move_ordinal_child_to_new_parent(new_parent: @target_book, child: @article, new_ordinal_position: @target_book.articles_count) redirect_to book_articles_path(@book), flash: { notice: "#{@article.title} successfully moved to #{@target_book.title}" } end end
Article notes
This is a [...].
This is a cloze note.
Hello [...].
Hello world.