Open scottjg opened 3 years ago
@scottjg Thanks for reporting the issue! Parser is a dependency that is specified in sorbet-rails
gemspec. Can you check if you see parser in your Gemfile and you have a parser.rbi file in your repo? The file should be autogenerated by sorbet as part of running "srb init" or "srb rbi gems"
sorry it took me so long to come back to this. in my case i hadn't run srb init
(i could never get it to work), so i guess it hadn't generated the Parser rbi. I appreciate your help and I realize you're basically playing tech support for me so i apologize in advance.
I tried everything again today:
sorbet
and sorbet-rails
into the Gemfile
, then bundle.bundle exec srb init
bundle exec srb tc
at this point there's no errors so i tried to get the rails stuff working
Channel
) and set type comment to # typed: true
bundle exec srb tc
at this point, the first error is:
./app/models/channel.rb:117: Method `show_recent_videos` does not exist on `Channel` https://srb.help/7003
117 | show_recent_videos
^^^^^^^^^^^^^^^^^^
in my case, this is a field in the schema (from schema.rb):
create_table "channels", force: :cascade do |t|
...
t.boolean "show_recent_videos", default: true, null: false
next, i tried running bundle exec rake rails_rbi:models
, which generated an rbi for Channel
.
unfortunately, upon running srb tc
again, now it appears my rails rbis are broken as i receive a few hundred of these errors:
./sorbet/rails-rbi/models/channel.rbi:435: Unable to resolve constant BatchEnumerator https://srb.help/5002
435 | ).returns(ActiveRecord::Batches::BatchEnumerator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./sorbet/rails-rbi/models/channel.rbi:548: Unable to resolve constant BatchEnumerator https://srb.help/5002
548 | ).returns(ActiveRecord::Batches::BatchEnumerator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if i run srb rbi gems
, then i'm back to this if i srb tc
again
./app/models/channel.rb:117: Method `show_recent_videos` does not exist on `Channel` https://srb.help/7003
117 | show_recent_videos
^^^^^^^^^^^^^^^^^^
i must be doing something obviously wrong... but alas, still no luck getting a typechecked rails model.
Describe the bug: Trying sorbet and sorbet-rails for the first time. Added sorbet-rails to my gemfile and ran:
which resulted in the following errors
Steps to reproduce:
Add sorbet-rails to gemfile. bundle. run
bundle exec srb typecheck -e 'puts "Hello, world!"
Expected behavior:
no errors
Versions: