RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: volontarian
Deprecation notice and advice from the author:
"Since Rails 3 came out, I have no longer used Inherited Resources. I have found that the responders abstraction and custom Rails generators offer the perfect balance between hiding and showing too much logic. That said, I suggest developers to make use of the responders gem (at github.com/plataformatec/responders) and no longer use Inherited Resources."
You just have to put the following lines at the top of your features/support/env.rb:
There is a list of available vagrant box packages which is not including Fedora yet: http://www.vagrantbox.es/
I think you have to create your own through VirtualBox (select your operating system and version at the Create Virtual Machine Wizard, Fedora available?) in consideration of vagrant's guidelines for virtual boxes (http://vagrantup.com/docs/base_boxes.html): https://www.virtualbox.org/manual/ch01.html#gui-createvm
Then you have to package the box through vagrant: http://vagrantup.com/docs/base_boxes.html
I think ruby users on win32 (RubyInstaller & DevKit) will have to do "gem install ffi -v=1.0.9" before "gem install vagrant". There are issues with the current version of this virtualbox - dependency: https://github.com/ffi/ffi/issues/167
On the other hand the setup of vagrant on win64 runs well through jruby: http://vagrantup.com/docs/getting-started/setup/windows_x64.html
The ActiveRecord association User-Appointment is wrapped by a decorator through UserDecorator#appointment mentioned above, so you get a AppointmentDecorator when calling @user.appointment
I think you have to eagerload all associations needed by your view in you controller:
@user = UserDecorator.new(User.includes(:appointment).find(params[:id]))
Then there should be no extra query when calling user_decorator.appointment.
Maybe I would centrally put this method in ApplicationDecorator (not tested):
def element_if_present(key, attribute)
content_tag(:dt, I18n.t(key)) + content_tag(:dd, self.send(attribute))
Then you have to call @user.element_if_present('your_scope.twitter', 'twitter') instead and also have the presenter output this container markup but only once in ApplicationDecorator.
Like Ryan said about decorating a User - Posts assocation, you just have to create a method UserDecorator#appointment with AppointmentDecorator.new(model.appointment).