railsjazz / ask_chatgpt

AI-Powered Assistant Gem right in your Rails console. Full power of ChatGPT in Rails
https://www.railsjazz.com/
MIT License
253 stars 13 forks source link

Should it require ActiveRecord .present? for the commandline version? (ruby 3.2.2 + Rails 7.1.0.alpha) #12

Closed basicfeatures closed 1 year ago

basicfeatures commented 1 year ago

Just a lil confused:

$ ask_chatgpt -q "how to?"
/home/dev/.local/share/gem/ruby/3.2/gems/ask_chatgpt-0.6.0/bin/ask_chatgpt:71:in `<top (required)>': undefined method `present?' for nil:NilClass (NoMethodError)

if options[:model].present?
                  ^^^^^^^^^
        from /home/dev/.bundle/ruby/3.2/bin/ask_chatgpt:25:in `load'
        from /home/dev/.bundle/ruby/3.2/bin/ask_chatgpt:25:in `<main>'

$ cat ../.profile
PATH=/home/dev/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/home/dev/.bundle/ruby/3.2/bin:/home/dev/.local/share/gem/ruby/3.2/bin; export PATH

GEM_HOME=/home/dev/.bundle/ruby/3.2:/home/dev/.local/share/gem/ruby/3.2; export GEM_HOME
igorkasyanchuk commented 1 year ago

@basicfeatures does it happen only with a Rails 7.1 alpha for you?

basicfeatures commented 1 year ago

All good here. Thanks a lot for this tool!

basicfeatures commented 1 year ago

Maybe it's better to just avoid using Rails-specific methods outside of a Rails context though.

igorkasyanchuk commented 1 year ago

Doing you want to contribute? Should be easy