Giter Club home page Giter Club logo

active_attr's People

Contributors

andrykonchin avatar artinboghosian avatar bpoweski avatar cgriego avatar cwest avatar eregon avatar geoffharcourt avatar gogainda avatar goganchic avatar jackal998 avatar jbhannah avatar kbaba1001 avatar koic avatar laserlemon avatar matthodan avatar mindreframer avatar msaffitz avatar rmm5t avatar robin850 avatar sparksp avatar steveh avatar subvertallchris avatar vfonic avatar wonda-tea-coffee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

active_attr's Issues

Build on Travis

Add travis config, hook, and a README.md with SSL build image.

Associations

Models have associations with other models, and attributes don't cover this case very well (especially when initializing a model with a deeply nested hash).

Attributes.attribute_names

ActionPack will try to determine the attributes a model has by accessing the class method .attribute_names. One use case is in ParamsWrapper. ActiveRecord returns an Array of Strings.

StrictMassAssignment

This module will raise an exception when mass assigning attributes that include an unknown attribute.

Rename Model to BasicModel

Model will be reserved for a full-featured model while BasicModel is just the bare minimum to pass ActiveModel's lint.

Yardoc

Setup and backfill documentation using yard.

Logger

Class and instance logger accessors, default to Rails Logger.

Time Zone Conversion

Similar to type casting, but it's conversion of the data instead of the type. For example, normalize Time/DateTime to UTC. Related is stripping fractional seconds.

Model

An mostly all-in-one starting point, comes with what most people would expect to be built-in.

QueryAttributes

Defines #{attr}? and #attribute?

The behavior of these methods will be affected by Typecasting.

Replace StrictMassAssignment with injectable behavior

Instead of StrictMassAssignment being a module, change MassAssignment to use injectable behavior for dealing with unknown attributes. Allow a default behavior to be set on the class (overridden on subclasses and a global default on the module) and use options to override the behavior at call time.

MultiParameterAttributes

Handle ActionPack's multi-parameter params for complex attributes that come from date fields and such.

MassAssignment

Including MassAssignment should get you an #initialize(attributes) method and an #attributes= method that walks a hash and assigns values if the object responds to a setter for the key.

Initialization methods do not chain

This means that right now you can't mix MassAssignment and Attributes together and both work.

  1. I tried just calling super, and that works great in 1.9 but fails in 1.8 because Object#initialize in 1.8 doesn't accept any arguments while 1.9 will accept any number of arguments. 1.8 fails with ArgumentError.
  2. I tried using alias method chaining, but as soon as the class defines its own #initialize then it overwrites the carefully chained initialization methods.
  3. I tried and considered other things as well…
  4. I think the best shot is to do alias method chaining inside of an anonymous Module similar to how ActiveModel::AttributeMethods works.

Dynamic Attributes

Makes a model schemaless model to allow undefined attributes to be written and read, similar to a struct.

MassAssignmentSecurity

Use ActiveModel::MassAssignmentSecurity, with its roles support, hooked into the MassAssignment methods.

AttributeDefaults

Allow defaults to be defined for attributes. Support procs for lazy evaluation. Should be applied at initialization.

NestedAttributes

Actionpack's FormHelper depends on particular methods being present to work with nested/association attributes.

Typecasting

Offer typecasting by attribute. @attributes should stay in the raw form. Method for getting the attribute value from before typecasting should be available. Probably need to define #read_attribute_for_validation that reads the before typecast value.

.attribute(:attr_name, :type => Class)

Typecasting flyweight

Give the large amount of typecasting that could occur, it would be useful for the framework to cache the results of the conversion for types.

  1. opt in
  2. lifecycle methods to purge the cached conversions
  3. block form to disable the action
  4. block form to enable the action

MassAssignmentSecurity

Use ActiveModel::MassAssignmentSecurity, with its roles support, hooked into the MassAssignment methods.

Model

The bare bones required to pass ActiveModel's lint tests.

InitializationCallback

I debate the usefulness of this, but a module that provides an after_initialize callback will provide parity with ORMs and make it easier to hook into initialization for novice Ruby coders.

Attributes

Including Attributes gets you attribute definition with .attribute (no typecasting) with #{attr}, #{attr}=, #read_attribute, #write_attribute, and #attributes that utilize an internal @attributes instance variable.

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.