-
Notifications
You must be signed in to change notification settings - Fork 0
command line vs. irb vs. rails console
E. Lynette Rayle edited this page May 28, 2022
·
1 revision
Execute in terminal window.
ruby ruby_file.rb
irb and rails console are both used as an interactive test environment. Each command is executed in the terminal window. exit
is used to leave each.
To test ruby basics:
irb
To execute with app's load path:
bundle exec irb
To test in full app context:
bundle exec rails c
Within irb or rails console:
load ruby_file.rb
Some gems may need a require statement to work:
require 'json'
json_hash = JSON.parse(json_str)