wavii / rails-dev-tweaks Goto Github PK
View Code? Open in Web Editor NEWA collection of tweaks to improve your Rails (3.1+) development experience.
Home Page: http://wavii.com
License: MIT License
A collection of tweaks to improve your Rails (3.1+) development experience.
Home Page: http://wavii.com
License: MIT License
We have a model in a subdirectory
/app/models/fa/base.rb
Defined like so
class FA::Base < ActiveResource::Base
#code
end
We just upgraded from 3.0.9 -> 3.1.2. The app works in 3.1.2. I added this to our Gemfile
gem 'rails-dev-tweaks', '~> 0.6.1'
And then our app crashed on the first page load with
LoadError
Expected /Users/gary/dev/artful.ly/app/models/fa/base.rb to define Base
When we changed the class declaration to
class Base < ActiveResource::Base
Rails crashed with
ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:490:in `load_missing_constant': Expected /Users/gary/dev/artful.ly/app/models/fa/base.rb to define FA::Base (LoadError)
Which was expected
Our autoload paths are:
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
config.autoload_paths += Dir["#{Rails.root.to_s}/app/models/**/"]
I've been reading about autoload issues between 3.0 and 3.1, but again this app runs without rails-dev-tweaks installed. Something is amiss somewhere. I haven't dove into the rails-dev-tweaks code yet but I'm about to get going on it.
I tried this with 0.6.0 and 0.5.2
Using Ruby 1.9.2
Let me know what other info will help diagnose. Thanks!
Did I miss anything? I have not a percent more speed achieved. I did some comparements and it got even slower on average (200 - 300 ms). Using the latest thin-server. Thanks!
I tried to upgrade my app to Rails 4.0.0.rc1, but bundling breaks on rails-dev-tweaks:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails-dev-tweaks (>= 0) ruby depends on
rails (~> 3.1.0.rc4) ruby
rails (4.0.0.rc1)
Could you look into updating the gem to make it work with Rails 4? (Or is it not needed anymore with Rails 4?)
The installation readme shows:
gem 'rails-dev-tweaks', '~> 1.1'
However, it looks like the latest version is 1.2. Is the readme out of date?
This will make it show up on rubygems.org. I'm doing due diligence on our gems and need to find out the licenses for all the gems. Having it show up on rubygems.org cuts out the step of having to go to the github repo.
With routing-filter (v0.3.1) and rails-dev-tweaks (0.6.1) both enabled, and using filter :locale in routes.rb, the locale param is lost (ie. if params is dumped out it won't contain a locale key). params[:locale] is properly set if rails-dev-tweaks is disabled.
Would it be possible to allow logging to be configured on / off for https://github.com/wavii/rails-dev-tweaks/blob/master/lib/rails_dev_tweaks/granular_autoload/middleware.rb#L31.
Trying to keep a tidy log ;-)
I am in the process of upgrading our app to Rails 4.2 from 3.2. After getting gem dependencies taken care of, I started the server and began trying to open various static pages. I noticed that, even with a 200 Completed message in the server console, the pages were not loading the browser. The screen just remained white and the "activity" indicator in the tab would spin endlessly. There were no errors in the JS console.
Sometimes this process in the browser never ended, sometimes the page finally loaded but was missing certain assets, other times it finally displayed but still just took a really long time.
After trying a lot of configuration changes in development.rb
and application.rb
I decided to just start commenting gems out of the Gemfile. I started with the development
group since it seemed like the most likely place. Upon completely commenting out that group, the problem went away. So I chose "rails-dev-tweaks" by itself since it seemed like something that might touch asset loading, etc, and when I uncommented that one the problem immediately reoccurred.
Sorry that my technical skill isn't good enough to comment more on this. It just seems like I have this problem only when the gem is active. Any suggestions?
Rails 4.2
rails-dev-tweaks 1.1.0
After adding gem 'rails-dev-tweaks', '0.5.0'
to the development group in the Gemfile, I get the following error and stacktrace when starting the Rails server
NoMethodError (undefined method `call' for nil:NilClass):
activesupport (3.1.0) lib/active_support/whiny_nil.rb:48:in `method_missing'
routing-filter (0.2.4) lib/routing_filter/adapters/rails_3.rb:74:in `recognize_with_filtering'
rails-dev-tweaks (0.5.0) lib/rails_dev_tweaks/granular_autoload/matchers/asset_matcher.rb:4:in `call'
rails-dev-tweaks (0.5.0) lib/rails_dev_tweaks/configuration.rb:72:in `block in should_reload?'
rails-dev-tweaks (0.5.0) lib/rails_dev_tweaks/configuration.rb:71:in `each'
rails-dev-tweaks (0.5.0) lib/rails_dev_tweaks/configuration.rb:71:in `should_reload?'
rails-dev-tweaks (0.5.0) lib/rails_dev_tweaks/granular_autoload/middleware.rb:21:in `call'
rack (1.3.2) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.2) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.2) lib/rack/lock.rb:15:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/static.rb:53:in `call'
dragonfly (0.9.5) lib/dragonfly/cookie_monster.rb:9:in `call'
dragonfly (0.9.5) lib/dragonfly/middleware.rb:13:in `call'
rack-cache (1.0.3) lib/rack/cache/context.rb:132:in `forward'
rack-cache (1.0.3) lib/rack/cache/context.rb:243:in `fetch'
rack-cache (1.0.3) lib/rack/cache/context.rb:181:in `lookup'
rack-cache (1.0.3) lib/rack/cache/context.rb:65:in `call!'
rack-cache (1.0.3) lib/rack/cache/context.rb:50:in `call'
railties (3.1.0) lib/rails/engine.rb:455:in `call'
railties (3.1.0) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.3.2) lib/rack/urlmap.rb:52:in `block in call'
rack (1.3.2) lib/rack/urlmap.rb:46:in `each'
rack (1.3.2) lib/rack/urlmap.rb:46:in `call'
rack (1.3.2) lib/rack/showexceptions.rb:24:in `call'
railties (3.1.0) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.2) lib/rack/handler/webrick.rb:59:in `service'
/Users/watson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/watson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/watson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Hi,
This Gem worked very well for me on Rails 4.0. Thanks for making it! Unfortunately it doesn't on 4.1:
irb(main):001:0> Rails.application.class.method_defined?(:reload_dependencies?)
=> false
This means that RailsDevTweaks::GranularAutoload::Middleware.reload_dependencies?
always returns true, which makes this gem pretty much unusable with 4.1 because any savings gained from not reloading assets are negated by the overhead of always reloading classes even when nothing has changed.
Can I suggest to declare incompatibility with Rails 4.1 in the gemspec?
can we make this compatible with rails latest ~> 3.2.x ?
The pull request #9 you merged makes a huge difference to this gem. It takes it from an average improvement to an excellent improvement. Please push what is latest on github to rubygems. If you need maintainers for this gem I'm more than happy to do it.
via rails/sass-rails#5 (comment)
Started GET "/assets/icons/ajax-loader.gif" for 127.0.0.1 at 2011-07-12 13:43:15 +0800
RailsDevTweaks: Skipping ActionDispatch::Reloader middleware for this request.
Served asset /icons/ajax-loader.gif - 304 Not Modified (1ms) (pid 16956)
Started GET "/admin/countries" for 127.0.0.1 at 2011-07-12 13:43:21 +0800
Processing by Admin::CountriesController#index as HTML
MONGODB w2d_asia_development['users'].find({:_id=>BSON::ObjectId('4e13e3499a4b7c395b000001')})
Completed 500 Internal Server Error in 355ms
NoMethodError (undefined method `to_sym' for nil:NilClass):
Full stack: https://gist.github.com/1077536
Can you please publish a new gem for the latest 1.x version? Thanks.
I just removed this gem from my Rails 4.x project and it sped up immensely. Please scope the gem to Rails 3.x.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.