help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
ruby-todo-list
/
app
/
controllers
RSK World
ruby-todo-list
Ruby Todo List - Task Management with User Authentication + Categories + Search + File Attachments + Email Notifications + Rails MVC + Modern Web Interface + API Integration + Educational Design
controllers
  • api
  • application_controller.rb621 B
  • categories_controller.rb1.5 KB
  • tasks_controller.rb1.7 KB
.keeptasks_controller.rb
app/channels/.keep
Raw Download
Find: Go to:
# Ruby To-Do List Application - Channels Directory
# Created by: Molla Samser (help@rskworld.in, +91 93305 39277)
# Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
# Year: 2026
4 lines•204 B
text
app/controllers/tasks_controller.rb
Raw Download
Find: Go to:
# Ruby To-Do List Application - Tasks Controller
# Created by: Molla Samser (help@rskworld.in, +91 93305 39277)
# Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
# Year: 2026

class TasksController < ApplicationController
  before_action :set_task, only: [:show, :edit, :update, :destroy, :toggle_complete]

  def index
    @query = params[:q]
    @tasks = Task.search(@query, current_user).pending.order(priority: :desc, created_at: :desc)
    @completed_tasks = current_user.tasks.completed.order(completed_at: :desc).limit(5)
  end

  def show
  end

  def new
    @task = current_user.tasks.build
  end

  def create
    @task = current_user.tasks.build(task_params)

    if @task.save
      redirect_to tasks_path, notice: "Task was successfully created."
    else
      render :new, status: :unprocessable_entity
    end
  end

  def edit
  end

  def update
    if @task.update(task_params)
      redirect_to tasks_path, notice: "Task was successfully updated."
    else
      render :edit, status: :unprocessable_entity
    end
  end

  def destroy
    @task.destroy
    redirect_to tasks_path, notice: "Task was successfully deleted."
  end

  def toggle_complete
    @task.toggle_completion!
    redirect_to tasks_path, notice: "Task status updated."
  end

  def completed
    @tasks = current_user.tasks.completed.order(completed_at: :desc)
  end

  def pending
    @tasks = current_user.tasks.pending.order(priority: :desc, created_at: :desc)
  end

  private

  def set_task
    @task = current_user.tasks.find(params[:id])
  end

  def task_params
    params.require(:task).permit(:title, :description, :priority, :due_date, :completed, :category_id, attachments: [])
  end
end
70 lines•1.7 KB
ruby

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer