Closed jerryskye closed 5 years ago
RE: Thanks for Jets, I absolutely love it β€οΈ
Thanks for the kind words.
Thinking defining a custom inflection here may help you http://rubyonjets.com/docs/custom-inflections/
Hey, a custom inflection did indeed help me, thanks a lot π
I still think we should really switch to camelize
here though :grin: I don't think classify
should be used for translating filenames to class names, I guess ActiveSupport
's documentation says it best, defining classify
as a method for creating class names from database table names, following the convention of plural and underscored table names and camel cased singular classes.
What do you think?
BTW I grepped through the source code and found some more potential places where classify
is used for this purpose. I was going to swap them all for camelize
and run the test suite, but I encountered this error:
An error occurred while loading spec_helper.
Failure/Error: require "jets-gems"
LoadError:
cannot load such file -- jets-gems
# /Users/hello/.rvm/gems/ruby-2.5.3@jets-test/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
# /Users/hello/.rvm/gems/ruby-2.5.3@jets-test/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
# /Users/hello/.rvm/gems/ruby-2.5.3@jets-test/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
# /Users/hello/.rvm/gems/ruby-2.5.3@jets-test/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
# ./lib/jets.rb:66:in `<top (required)>'
# ./spec/spec_helper.rb:16:in `require'
# ./spec/spec_helper.rb:16:in `<top (required)>'
There are some more errors, but I think they're caused by this LoadError
above.
Thanks for your help and have a nice day! :relaxed: Stay awesome! π
@jerryskye Oh interesting! I thought that classes generally get converted to their class name equivalent with classify
and didn't realize that classify
was only supposed to be table names. π€¦π»ββοΈ
If you can fix it that'll be amazing π If not, will take a look when got time π
RE: cannot load such file -- jets-gems
The jets-gem is currently package as a submodule. Here's how you get it:
git submodule init
git submodule update
Check that the vendor/jets-gems
folder is not empty. Then you should be good to run the test suite.
Yeah sure, I'll fix it :wink:
Wow, didn't notice the .gitmodules
there :sweat_smile:
Thanks! :relaxed:
Hello! Thanks for Jets, I absolutely love it β€οΈ I noticed a problem while trying to run
jets console
in my application, here's a quick rundown of it πChecklist
jets upgrade
command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/Expected Behaviour
I can define a class with a plural name, like
Quotes
and have no problem with eager loading.Current Behavior
The framework prevents me from having classes with plural names in my application if I want to eager load it.
Step-by-step reproduction instructions
echo 'class Quotes; end' > app/models/quotes.rb
jets console
Solution Suggestion
I believe the solution is to mimic the behavior from the
eager_load_jets
method and usingcamelize
instead ofclassify
in theeager_load_app
method here.