Coder Social home page Coder Social logo

Comments (10)

shioyama avatar shioyama commented on August 27, 2024 1

Interesting idea! I'll have a look and see what that would look like.

from mobility.

shioyama avatar shioyama commented on August 27, 2024 1

@simonknoll I see the problem. You need to enable fallbacks on the model in order to set them in the getter, otherwise the Mobility::Backend::Fallbacks module will not be included.

So if you define the Contribution model this way, it will work:

class Contribution < ApplicationRecord
  include Mobility
  translates :landing_page, type: :string, fallbacks: true
end

Note that if you then want somewhere else not to use fallbacks for landing_page, you'll need to pass fallback: false, i.e. contribution.landing_page(fallback: false).

We probably need a way to include the module, but disable it by default. I'm thinking about a natural interface for that...

from mobility.

shioyama avatar shioyama commented on August 27, 2024 1

Actually I'm noticing an issue with 0.1.7 which is causing lots of bogus warnings in the logs. I'll fix it tomorrow and release a new version. (Working on this on this branch.)

Also, I should be able to change the API so that it includes the fallbacks module by default, but only actually uses it if when fallback: ... is passed to the getter. But I want to think about this a bit more before making that change.

from mobility.

simonknoll avatar simonknoll commented on August 27, 2024

👍 thanks for considering!

from mobility.

shioyama avatar shioyama commented on August 27, 2024

@simonknoll see #9.

from mobility.

simonknoll avatar simonknoll commented on August 27, 2024

Thank you so much, this makes my live much easier!

from mobility.

shioyama avatar shioyama commented on August 27, 2024

#9 has been merged, closing this.

from mobility.

simonknoll avatar simonknoll commented on August 27, 2024

@shioyama I tried now with version 0.1.7 but I can't get it working. Maybe I'm using it not as intended. Anyways I've created a simple test project with a rspec test. This is the repository https://github.com/simonknoll/mobility-fallback

Cheers,
Simon

from mobility.

simonknoll avatar simonknoll commented on August 27, 2024

Thank you for the clarification @shioyama!

from mobility.

shioyama avatar shioyama commented on August 27, 2024

@simonknoll try version 0.1.10 (had to yank 0.1.8 + 0.1.9...).

from mobility.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.