Ruby on Rails

Ruby on Rails

Test your Ruby on Rails knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What command rolls back the last migration?

    • rails rollback
    • rails db:rollback
    • rails undo migration
    • rails migrate down
  2. Which file defines Rails gems?

    • routes.rb
    • database.yml
    • Gemfile
    • schema.rb
  3. Which convention does Rails follow?

    • Convention over Configuration
    • Configuration over Convention
    • Code over Convention
    • Manual Configuration Required
  4. What is 'bundle install' used for?

    • Running server
    • Installing project dependencies
    • Starting Rails console
    • Running migrations
  5. Which Rails command creates a controller?

    • rails generate controller
    • rails create controller
    • rails controller new
    • rails make controller
  6. Which command creates a migration file in Rails?

    • rails create migration
    • rails generate migration
    • rails migration new
    • rails db:create migration
  7. What does 'resources :posts' generate in routes?

    • Only show action
    • All RESTful routes
    • Only index and new
    • Custom routes only
  8. Which Rails feature helps avoid N+1 queries?

    • Callbacks
    • Eager Loading
    • Scopes
    • Validations
  9. Which gem is widely used for authentication in Rails?

    • Pundit
    • Devise
    • Omniauth
    • Sorcery
  10. Which Rails feature is used for background jobs?

    • ActionCable
    • ActiveJob
    • ActionMailer
    • ActiveRecord
  11. Which Rails module handles real-time features?

    • ActiveSupport
    • ActionCable
    • ActiveMailer
    • ActiveJob
  12. Which gem is used for API serialization?

    • FastJSON
    • ActiveModelSerializers
    • Jbuilder
    • Both B and C
  13. Which security feature prevents CSRF attacks?

    • Cross-origin filters
    • Authenticity Token
    • Parameter Filtering
    • Content Security Policy
  14. Which method helps avoid SQL injection in Rails?

    • Using sanitize_sql
    • Using parameterized queries
    • Using find_by_sql
    • Using raw SQL
  15. Which Rails cache store is suitable for distributed apps?

    • FileStore
    • MemoryStore
    • RedisStore
    • NullStore