Comments (12)
ok i created a new empty project and yes - you are right.
the evil is msgpack-rails
which messes(d!) around with stuff like
module ActiveRecord
module Serialization
include ActiveModel::Serializers::Msgpack
end
end
recent versions look fine however.
i wonder if that "change" might still help out - i guess there are many further bad written gems out there like msgpack-rails.
however, from my side this can be marked as closed. Thank you, @gerrywastaken
from awesome_print.
you are welcome + cheers for this gem ;)
from awesome_print.
Check out 0.2.0. You should be able to use awesome_print with Ruby scripts that use ActiveRecord outside of Rails.
from awesome_print.
i`d rather like to use AP without beeing forced to use ActiveRecord.
from awesome_print.
@thedanielhanke or @alexw668 How did you go about creating a Rails application which does not load AR?
from awesome_print.
@gerrywastaken We have apps that uses no-SQL database like MongoDB or Neo4j (a graph database) that don't deal with AR.
from awesome_print.
@alexw668 I mean, what is the process you used to stop it from loading. As in which file did you modify and how, so I can test the issue accurately and not end up making bad assumptions about your setup.
from awesome_print.
@gerrywastaken sorry for this short delay.
head config/application.rb -n 10
require File.expand_path('../boot', __FILE__)
require 'rails'
%w(
action_controller
action_view
action_mailer
).each do |framework|
begin
require "#{framework}/railtie"
was all i needed to do.
and ya i still miss AP :)
from awesome_print.
can be fixed like this:
def cast_with_active_record(object, type)
cast = cast_without_active_record(object, type)
return cast if !defined?(::ActiveRecord)
if object.is_a?(::ActiveRecord::Base)
should become
def cast_with_active_record(object, type)
cast = cast_without_active_record(object, type)
return cast if !defined?(::ActiveRecord::Base) #< -----------------
if object.is_a?(::ActiveRecord::Base)
or even by unless (defined?(::ActiveRecord) || defined?(::ActiveRecord::Base)
from awesome_print.
I'm not sure how this ended up closed. I haven't yet had a chance to look into it. Thanks for the info @thedanielhanke 👍
from awesome_print.
Ok so the original bug was created a long time ago so tracking it back, the problem was originally here:
https://github.com/awesome-print/awesome_print/blob/0.1.3/lib/ap/mixin/rails.rb#L17
It then moved here:
https://github.com/awesome-print/awesome_print/blob/0.2.0/lib/ap/mixin/active_record.rb
This commit should have then fixed the issue reported by @alexw668:
05265cb#diff-e567c486212ebaee39cf4091c38a4d84R17
Then in this commit the AcitveRecord::Base check was swapped for an ActiveRecord check:
dfbebd4#diff-e567c486212ebaee39cf4091c38a4d84L17
Now this should not have affected @alexw668 as for him ActiveRecord isn't defined at all, so I'm unclear how is he would still be hitting the original bug.
@thedanielhanke Your bug appears to be that ActiveRecord is somehow getting defined by something (before awesome print is loaded), but it doesn't create ActiveRecord::Base.
Your fix is good, but I don't think it's the same issue as was reported here. I suspect the issue reported here was fixed quite some time ago. @alexw668 can you confirm?
from awesome_print.
I'm just glad your issue was solved. I think it's a good change regardless and I suspect there will be others who are affected by this issue so I'll likely merge it in.
Cheers for investigating the root cause, I really appreciate that. 👍
I suspect @alexw668 was the one who originally closed this, but can't be sure as Github isn't telling me. I'll leave this open for three more days to give @alexw668 a chance to respond.
from awesome_print.
Related Issues (20)
- Proc.new is deprecated HOT 5
- irb: ArgumentError (wrong number of arguments (given 1, expected 0)) HOT 2
- Output of non-empty Hash object fails when using Ruby 3.0 HOT 1
- 1.9 release HOT 12
- Array#uniq is not working on pry with `AwesomePrint.pry!` HOT 5
- Ruby 2.7.0 compatibility HOT 2
- problem with rails and ruby 3.0.0 HOT 2
- ArgumentError (wrong number of arguments (given 1, expected 0)) HOT 4
- undefined method `marshal_dump` for `ActiveModel::Errors` HOT 6
- Getting FrozenError (can't modify frozen String: "false") after upgrading to Ruby 2.7.3 using awesome_print (1.9.2) HOT 5
- Plain Ruby Objects are not formatted properly HOT 2
- Hi, can I put `.aprc` under ~/.config/awesome_print/aprc?
- `.pry!` does nothing in rails console
- Don't override/monkey patch `String` class HOT 3
- Provide a way of specifying custom formatting on user-created classes/objects HOT 2
- object_id option not operating as expected
- Maintained fork: amazing-print/amazing_print
- Pretty print object as executable code
- ap.awesome_sequel_dataset(ds) Arguments Error
- ActiveRecord methods with `ap` displays nothing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome_print.