You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
Describe the bug:
In a Rails application the type of Rails.application is actually a subclass of Rails::Application that is generated when you type rails new. For example, rails new blog, Rails.application will create a class called Blog::Application defined in config/application.rb.
I am willing to make an attempt at fixing this if you think it's a valid change - let me know then I'll send a PR.
Steps to reproduce:
The impact of this is that any custom methods you define in application.rb on Blog::Application will not be visible to the type checker. If I have config/application.rb that looks like this:
# typed: truerequire_relative'boot'require'rails'# Require the gems listed in Gemfile, including any gems# you've limited to :test, :development, or :production.Bundler.require(*Rails.groups)moduleBlogclassApplication < Rails::Application# Initialize configuration defaults for originally generated Rails version.config.load_defaults5.2defname"Brad's awesome blog"endendend
then I can't call Rails.application.name in a type-safe way.
Versions:
$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
$ rails --version
Rails 5.2.1
$ srb --version
Sorbet typechecker 0.4.4429 git 51504253c985d0a967d3df6a39ac44b25db2c481 built on 2019-07-12 00:02:11 GMT with debug symbols
The text was updated successfully, but these errors were encountered:
On Thu, Jul 25, 2019 at 2:03 PM Bradley Buda ***@***.***> wrote:
Moved from: sorbet/sorbet-typed#83
<sorbet/sorbet-typed#83>
*Describe the bug:*
In a Rails application the type of Rails.application
<https://github.com/sorbet/sorbet-typed/blob/d17bc9ee37629ed824f78d3a2f92e99a8b4e8709/lib/railties/all/railties.rbi#L5>
is actually a subclass of Rails::Application that is generated when you
type rails new. For example, rails new blog, Rails.application will
create a class called Blog::Application defined in config/application.rb.
I am willing to make an attempt at fixing this if you think it's a valid
change - let me know then I'll send a PR.
*Steps to reproduce:*
The impact of this is that any custom methods you define in application.rb
on Blog::Application will not be visible to the type checker. If I have
config/application.rb that looks like this:
# typed: truerequire_relative 'boot'require 'rails'
# Require the gems listed in Gemfile, including any gems# you've limited to :test, :development, or :production.Bundler.require(*Rails.groups)
module Blog
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
def name
"Brad's awesome blog"
end
endend
then I can't call Rails.application.name in a type-safe way.
*Versions:*
$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
$ rails --version
Rails 5.2.1
$ srb --version
Sorbet typechecker 0.4.4429 git 51504253c985d0a967d3df6a39ac44b25db2c481 built on 2019-07-12 00:02:11 GMT with debug symbols
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#98?email_source=notifications&email_token=AAFH4ALKS4D6S4JEOGAQVOLQBIIINA5CNFSM4IG6NDSKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HBSO3BA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFH4AN56357CS4JF3PFIMTQBIIINANCNFSM4IG6NDSA>
.
Moved from: sorbet/sorbet-typed#83
Describe the bug:
In a Rails application the type of Rails.application is actually a subclass of
Rails::Application
that is generated when you typerails new
. For example,rails new blog
,Rails.application
will create a class calledBlog::Application
defined inconfig/application.rb
.I am willing to make an attempt at fixing this if you think it's a valid change - let me know then I'll send a PR.
Steps to reproduce:
The impact of this is that any custom methods you define in
application.rb
onBlog::Application
will not be visible to the type checker. If I haveconfig/application.rb
that looks like this:then I can't call
Rails.application.name
in a type-safe way.Versions:
The text was updated successfully, but these errors were encountered: