### Start Rails Web Server Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Command to change directory into the Rails application and start the web server. Use --help for available options. ```bash cd myapp; rails server ``` -------------------------------- ### Install Ensnare Script Source: https://github.com/ahoernecke/ensnare.test/blob/main/README.md This script installs the Ensnare gem plugin for Ruby on Rails. It fetches the latest version from GitHub and executes the installation process. ```shell curl -fsSL https://raw.githubusercontent.com/ahoernecke/ensnare.next/main/install.sh | bash ``` -------------------------------- ### Install Ruby Debugger Gem Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Command to install the ruby-debug gem, which is required to run the Rails server in debugging mode. ```bash sudo gem install ruby-debug ``` -------------------------------- ### Start Rails Console Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Launches the Rails console for interactive Ruby sessions within the application environment. Supports sandbox mode for safe database changes and environment-specific loading. ```shell rails console rails console -s rails console --sandbox rails console production ``` -------------------------------- ### Enable Debugger in Rails Server Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Instructions on how to start the Rails server with debugging enabled and how to use the debugger within a controller to inspect and modify application state. ```ruby class WeblogController < ActionController::Base def index @posts = Post.all debugger end end ``` -------------------------------- ### Debugging with IRB Prompt Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Example interaction with the Rails debugger, showing how to inspect and modify model objects at a breakpoint. ```irb >> @posts.inspect => "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>, #\"Rails\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" >> @posts.first.title = "hello from a debugger" => "hello from a debugger" >> f = @posts.first => #nil, \"body\"=>nil, \"id\"=>\"1\"}> >> f. Display all 152 possibilities? (y or n) ``` -------------------------------- ### Logging Messages in Rails Controller Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Example of how to log custom messages within a Rails controller using the logger class. These messages are written to the application's log files. ```ruby class WeblogController < ActionController::Base def destroy @weblog = Weblog.find(params[:id]) @weblog.destroy logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") end end ``` -------------------------------- ### Create New Rails Application Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Command to generate a new Rails application. This sets up the basic directory structure and configuration files for a new project. ```bash rails new myapp ``` -------------------------------- ### Connect to Database Console Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Provides direct command-line access to the application's database using credentials from database.yml. Supports connecting to different environments and works with MySQL, PostgreSQL, and SQLite 3. ```shell rails dbconsole rails dbconsole production ``` -------------------------------- ### Reload Rails Console Source: https://github.com/ahoernecke/ensnare.test/blob/main/test/dummy/README.rdoc Reloads controllers and models within an active Rails console session, allowing for code changes to be applied without restarting the console. ```shell reload! ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.