This is a sample application built with rails generate integrated with the social_stream engine.
The intention is to exercise the instructions for extending models shown at the social_stream wiki:
Some of the code has being inspired by the ViSH source code:
In this sample we focus on adding new accessible attributes as well as implementing the required migrations and rspec test cases.
These are the main steps taken:
-
define the specs
‘spec/spec_helper.rb`
‘spec/factories/user.rb`
‘spec/models/user_spec.`
-
define a module which extends attributes
`lib/sample_features.rb`
-
define the decorator, including the new module:
`app/decorators/social_stream/base/user_decorator.rb` (notice the dynamic attr_acessible change)
-
define the migration:
`rails generate migration AddSampleAttributeToUsers sample_attribute:string`
Execute:
‘rake db:migrate`
‘rake db:test:prepare`
‘rspec`