Giter VIP home page Giter VIP logo

settingcrazy's Issues

Model using setting_namespace fails the validation if not all namespaced templates pass

This behavior makes sense at first glance, but lacks flexibility if the model doesn't need all namespaced setting templates to be validated.

One use case describes as follows:

  • A scenario can be published to multiple search engines, e.g Google and Yahoo.
  • The Scenario model has both google and yahoo as setting namespace.
  • However, an individual scenario record may only wish to be published to Google, in which case validating Yahoo setting_values is not necessary and what even worse is the required option would fail the validation, such as Yahoo budget is not in place.

Need a mechanism to allow skipping of validations

Validations are used when we use a setting template. We should add if/unless options to setting namespace and use_setting_template to control when validations are applied. Eg;

use_setting_template FooTemplate, :validate_if => Proc.new { ... }

Calling settings.inspect drops all unsaved setting values

Two ways to reproduce this issue:

a) in settingcrazy gem, change line #10 to:

before    { subject.foo = "bar"; subject.inspect; model.save! }

and 3 examples would fail, or

b) fires up rails console of DC app, do the following:

vi = Scenario::Campaign::VendorInstance.last # make sure this instance doesn't have setting values at this point
vi.settings.platform = '1'
vi.settings # => {} not {:platform => '1'}
vi.save! # setting for platform is not saved

I believe line #70 in settings_proxy.rb causes this issue.

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.