cgriego / active_attr Goto Github PK
View Code? Open in Web Editor NEWWhat ActiveModel left out
License: MIT License
What ActiveModel left out
License: MIT License
Create a YARD Handler for the .attribute DSL.
Handle doc comments for the attributes and overridden implementations with their own doc comments.
Verify compatibility with FactoryGirl's associations support.
http://thechangelog.com/post/3032074343/top-ten-reasons-why-i-wont-use-your-open-source-project
Since attributes now have meaningful options, redefining an attribute should replace the attribute instead of being ignored.
Add travis config, hook, and a README.md with SSL build image.
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).
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.
Verify compatibility with FactoryGirl
This module will raise an exception when mass assigning attributes that include an unknown attribute.
Model will be reserved for a full-featured model while BasicModel is just the bare minimum to pass ActiveModel's lint.
Setup and backfill documentation using yard.
Class and instance logger accessors, default to Rails Logger.
Initialize should accept a block form
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.
An mostly all-in-one starting point, comes with what most people would expect to be built-in.
Defines #{attr}? and #attribute?
The behavior of these methods will be affected by Typecasting.
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.
Handle ActionPack's multi-parameter params for complex attributes that come from date fields and such.
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.
This means that right now you can't mix MassAssignment and Attributes together and both work.
Not provided by ActiveModel, this is unique to each modeling library.
Activate all rspec matchers by requiring active_attr/rspec.
Validate compatibility with validates_timeliness
Makes a model schemaless model to allow undefined attributes to be written and read, similar to a struct.
Use ActiveModel::MassAssignmentSecurity, with its roles support, hooked into the MassAssignment methods.
Allow defaults to be defined for attributes. Support procs for lazy evaluation. Should be applied at initialization.
Actionpack's FormHelper depends on particular methods being present to work with nested/association attributes.
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)
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.
Use ActiveModel::MassAssignmentSecurity, with its roles support, hooked into the MassAssignment methods.
Self explanatory
The bare bones required to pass ActiveModel's lint tests.
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.
A matcher, and macros, for specifying ActiveAttr associations.
ActiveRecord calls this a DangerousAttributeError. Mongoid calls it an InvalidField.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.