1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00
Commit graph

34 commits

Author SHA1 Message Date
Andrew Haines
b5fc398bca Fix Decoratable#decorator_class
It was possible that `Model.decorator_class` and
`Model.new.decorator_class` might be two different things.
2012-11-08 00:50:35 +00:00
Andrew Haines
acd914fbc9 Remove unused support classes 2012-11-01 02:06:03 +00:00
Andrew Haines
dc53646376 Add UninferrableDecoratorError 2012-11-01 02:06:03 +00:00
Andrew Haines
e1214d97b6 Remove .decorates method 2012-10-31 17:55:38 +00:00
Chris Heald
6e6217a484 Clear the context per request, and assign a controller reference that is used to create a new view context on demand if needed by draper outside of a template context. Fixes #287. Split out the system initialization into action_controller and action_mailer pieces for clarity. Guarded the view context lazy initialization to only attempt to create a test context if the proper test classes exist (as they won't outside of test mode). 2012-10-01 14:30:18 -07:00
Steve Klabnik
151a785da9 removing un-needed things for testing 2012-08-30 09:12:37 -07:00
stevenbristol
59363d407c tests for decorating enumerable proxy 2012-08-30 09:00:37 -04:00
Steve Klabnik
1dcbe68ee8 Totally change test integration.
We no longer need to do specific things before tests run. The
view_context now loads up appropriate things if they don't exist.

I ended up getting rid of two spec files; one tested things that
were very simple, but since we're not mocking Rails anymore, they're
much harder to test. The second was the stuff that I removed. :)
2012-08-28 22:42:38 -07:00
Joseph Hsu
c46b0fd17d move fake ActiveRecord::Relation to helper, use #kind_of instead of comparing to string 2012-08-22 21:45:55 -04:00
Andy Ogzewalla
7259279ba5 Additional specs for denies_all 2012-08-11 22:11:09 -05:00
Steve Klabnik
7d49427340 Merge pull request #239 from iblue/sequel-support
Support for Sequel
2012-08-09 15:39:16 -07:00
Steve Klabnik
0b03d9c21e Monkeypatch ActionController::Base.
We need to be able to let draper get a copy of the view_context
no matter what happens. AC::Base doesn't really let us do that. So
we have to monkeypatch.

This was originally suggested in
https://github.com/jcasimir/draper/issues/124#issuecomment-6954291
by @rf-.

It appears to be the cleanest way to take care of this problem, and
shouldn't affect any other things, since we keep the exact same
semantics of view_context.

Theoretically:

Fixes #124
Fixes #109
2012-07-17 09:40:52 -04:00
Markus Fenske
ace6a0eb03 Support for Sequel 2012-07-16 19:23:35 +02:00
Steve Klabnik
4290ef61c5 Don't need to require rubygems anymore 2012-05-13 17:56:32 -04:00
Chris Heald
eea4c866a6 If special ActiveModel methods like #id, #errors, and #to_param are defined directly on the decorator, do not redefine them as proxy methods. 2012-05-10 17:50:22 -07:00
Steve Klabnik
3356b5ffe7 Fix initialization issue for ammeter 2012-05-09 18:58:19 -04:00
Steve Klabnik
b516bda9c5 Merge branch 'active_model_support' of https://github.com/kurko/draper 2012-05-09 14:37:12 -04:00
Alexandre de Oliveira
19496f0c4f Adds support for ActiveModel::Errors
The goal here is to improve ActiveModel support so that Draper can
work seamlessly with Rails' FormHelpers, proxying the model's #errors
method.

I also added support for ActiveModel::Errors, adding a proxy to the
model's #errors method only if it's a descendant of
ActiveModel::Validations.

Also some refactoring was done. Draper now proxies #to_param and #id
methods only if the model is an ActiveModel descendant.

Other things I did include:

- created Draper::ActiveModelSupport::Proxies, which contains the
  methods for proxying default methods(to_param, id, etc) depending
on the ancestors
- wrote specs for class with ActiveModel as ancestor
- wrote specs for class without ActiveModel as ancestor
2012-05-07 23:24:01 -03:00
Vasiliy Ermolovich
49f01d9086 rework generators 2012-04-28 23:02:22 +03:00
Simon COURTOIS
108d4baaaf Adding a :polymorphic option to decorates_association 2012-03-08 14:21:26 +01:00
Morton Jonuschat
53586b8a38 Allow multiple allows 2012-02-13 10:58:07 +01:00
Michael Fairley
cb8820083f Add a require that got left out 2012-01-05 09:30:28 -08:00
Steve Klabnik
10d2a6ed9a explicitly require-ing to fix odd order issue 2012-01-05 10:47:18 -05:00
Jeff Casimir
91bfd0138e Debugging require ordering issue on Travis 2011-11-01 17:09:20 -04:00
Jeff Casimir
57a159362c Debugging require ordering issue on Travis 2011-11-01 17:07:11 -04:00
Justin Ko
6a595ab20f Move spec/samples to spec/support/samples 2011-10-24 11:48:53 -06:00
Jeff Casimir
39fc5c9513 Rewrote technique for getting view_context/helper access 2011-10-08 01:06:19 -04:00
Jeff Casimir
6c10302cd3 Simplifying development dependencies 2011-10-07 16:37:36 -04:00
Alex Rothenberg
16e8868da1 added generator specs using the ammeter gem 2011-10-06 16:58:04 -04:00
Jeff Casimir
3edcab921a Simplifying loading in spec_helper thanks to new dependency style 2011-08-27 23:52:03 -05:00
Theo Cushion
2614037c74 Feature: Added Ruby 1.8 support 2011-08-10 14:01:22 +01:00
Jeff Casimir
36911776f3 Implementing lazy_helpers and improving test coverage 2011-07-27 23:45:09 -05:00
Jeff Casimir
6a6f7e68da Pulling larger example classes out into spec/samples 2011-07-10 21:46:30 -04:00
Jeff Casimir
a3804b0662 Bring over generator structure from rails_decorators 2011-06-30 18:19:48 -04:00