Comments (13)
Released 0.2.1 with these fixes: https://rubygems.org/gems/mobility/versions/0.2.1
from mobility.
@shioyama,
This also seems to be happening:
/home/vagrant/.rvm/gems/ruby-2.3.3/bundler/gems/mobility-d58081ef2e2f/lib/mobility/backends/sequel/pg_hash.rb:42:in `block in class:PgHash': uninitialized constant Mobility::Sequel::ColumnChanges (NameError)
(dont mind that its from github, it also happened with the one on rubygems)
Initalizer:
Mobility.configure do |config|
config.default_backend = :jsonb
config.accessor_method = :translates
config.query_method = :i18n
end
from mobility.
Thanks, about the first warning, I'm guessing that Mobility is able to load 'rails' but then something fails to load after that, probably 'rails/generators'. The result would be that it sets Mobility::Loaded::Rails
first to true, then back to false.
I can't imagine that rails would be included in your application... does require 'rails'
raise a LoadError
from console with your Gemfile?
from mobility.
Hi @shioyama,
It raises:
=> false
I have these "rails" gems in the lockfile:
rails-dom-testing
railties
rails-html-sanitizer
Any idea how to fix the Mobility::Sequel::ColumnChanges one?
from mobility.
Ok, then I see the issue. The core problem is that ruby doesn't have "optional dependencies", so the way gems typically do this is to try requiring a dependency, and catch the LoadError
if it fails to load. But in this case you have rails, but not another dependency, so this breaks down.
I can this I think, I'll just need to require the generators separately and not assume they are bundled with rails.
The second issue is just a missing requires in "mobility/backends/sequel/pg_hash". Can you try pointing to the require_column_changes
branch?
from mobility.
I've merged the branch into master
, if you use the latest the ColumnChanges issue should be fixed.
from mobility.
Also, I realized the other warning issue is because in your case you have "rails", but not "activerecord", whereas the rails generators assume that AR is loaded. This is an issue of how things are required, I'll fix it in the next day or two and release a new version. Thanks for pointing out the issue!
Let me know if the other (second) issue is fixed on master
.
from mobility.
Try the load_rails
branch which has fixes for both issues.
from mobility.
@shioyama,
load_rails fixed both.
But a 2 new errors occur. If I dont add data to a jsonb that was created with:
jsonb :synopsis
It will say: Sequel::Error: The AND operator requires at least 1 argument
If I add data to the only 2 jsonb columns in the model (Sequel::Model) it gives.
2.3.3 :004 >
m.synopsis = "test"
=> "test"
2.3.3 :005 > m.save
Sequel::DatabaseError: PG::DatatypeMismatch: ERROR: column "synopsis" is of type jsonb but expression is of type boolean
LINE 1: ...gas" ("synopsis", "title", "created_at") VALUES (('en' = 'te...
^
HINT: You will need to rewrite or cast the expression.
And the model:
translates :title, type: :string
translates :synopsis, type: :text
from mobility.
@jnylen Are you sure the column is of type jsonb
? What does your schema look like?
from mobility.
Oh never mind...
from mobility.
By the way,
Here are the sequel related gems in Gemfile:
sequel (4.49.0)
sequel-annotate (1.0.0)
sequel (>= 4)
sequel-rake (0.1.0)
thor (~> 0.19)
sequel_pg (1.7.0)
pg (>= 0.8.0)
sequel (>= 4.0.0)
sequel_polymorphic (0.3.1)
sequel (~> 4)
sequel_sluggable (0.0.6)
sequel (>= 3.0.0)
from mobility.
I'm going to close this issue and merge the branch since that resolves it. Can you please post a new issue about the jsonb error?
from mobility.
Related Issues (20)
- Not compatible with FastGettext - request for string available locale support HOT 2
- Error when installing on Vitess MySQL db HOT 4
- The presence plugin doesn't work as expected HOT 1
- Destruction of record+translations fails, when model IDs are of the type "varchar(36)" (a UUID string) HOT 3
- accessor super method doesn't work with arguments like class.value(locale: :de) HOT 1
- ordering by specific locale HOT 2
- Add type checking plugin reference HOT 3
- eager_load and pluck builds the wrong query HOT 1
- `i18n` scope incompatible with `exists?` HOT 1
- validates presence: true failing with cache active HOT 3
- Empty content row is created in translation table. HOT 1
- No fixtures are generated / No doc on how to make them ourselves HOT 2
- Not working properly with Rails 7.1.1 HOT 1
- Cannot inject the query when using query method block HOT 2
- Allow composite foreign keys HOT 3
- Mobility with active_storage for translatable attachements HOT 1
- 1.3.0.rc1 Can't assign an translated attribute with a column fallback HOT 2
- Fallbacks in runtime HOT 1
- Migration from `globalize`: foreign keys
- table fallbacks
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 mobility.