Commit Graph

3869 Commits

Author SHA1 Message Date
Joshua Peek
f69f9820ee Wrap up http related routing helpers 2009-11-29 17:45:12 -06:00
Joshua Peek
312c3bfa24 Break down long match routing method 2009-11-29 17:39:37 -06:00
Joshua Peek
5da01a92c7 Make use of extract_options! 2009-11-29 17:01:14 -06:00
Joshua Peek
40ae2070d5 Extract Resource and SingletonResource helper objects 2009-11-29 16:59:44 -06:00
Joshua Peek
3f025e6408 Resource collection should be defined before member routes 2009-11-29 15:23:27 -06:00
Bryan Helmkamp
bb84cab2fc Update reference to deprecated constant to avoid warnings 2009-11-28 23:41:03 -08:00
Yehuda Katz
45d8ff08a4 Remove reference to class that doesn't exist (ht: brynary) 2009-11-28 21:36:58 -08:00
Joshua Peek
59dbae145b Privatize Routing.possible_controllers and fix brittle url helper
controller test loading.
2009-11-23 21:50:21 -06:00
Joshua Peek
15ab3a98a1 Find all controllers in memory to use for routing 2009-11-23 20:20:50 -06:00
Joshua Peek
f987e8561c with_controllers is no longer used 2009-11-23 19:45:42 -06:00
Joshua Peek
8d351eac07 Extract Routing.controller_constraints 2009-11-23 19:44:43 -06:00
Joshua Peek
01c9f99c53 Kill dead routing internals helpers 2009-11-23 19:17:53 -06:00
Joshua Peek
ef771552b7 Don't really care about reloading routes when inflections are
changed.
2009-11-23 18:59:48 -06:00
Joshua Peek
4b325fcd1a Update routing for rackmount 0.2 api changes 2009-11-19 17:58:57 -08:00
Joshua Peek
5df26dd7a9 Add basic nested named route support to new routing dsl. Also add a
bunch of pending tests.
2009-11-19 09:04:53 -08:00
Jeremy Kemper
e1385be025 Extract form_authenticity_param instance method so it's overridable in subclasses 2009-11-17 23:40:06 -08:00
Will Read
7fadb3f261 Allow explicit placement of hidden id element for nested models.
[#3259 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-15 21:47:57 +01:00
Jeremy Kemper
3f54f3100b Ruby 1.9.2: StringIO no longer has #path 2009-11-13 13:10:28 -08:00
José Valim
2cb47c742f Split mime responder into smaller chunks and allow action to be configured.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-13 09:52:52 -08:00
Joshua Peek
a28d0ea33e Remove rackmount const usage 2009-11-12 23:33:30 -06:00
David Vrensk
af44b07649 Rdoc for changes introduced in e2ed1a1ca, 36058f450.
[#3451 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-12 11:21:44 -08:00
Jeremy Kemper
631a27d6a5 Revert "Revert "Eliminate warning with layout is unset""
This reverts commit d8fd0499bfd6edc676ff3fbffc327656f6d5c320.
2009-11-10 16:15:43 -08:00
Jeremy Kemper
d8fd0499bf Revert "Eliminate warning with layout is unset"
This reverts commit 1fcf32f8fef8fb5a63a66edacf556a107d12c049.
2009-11-10 16:09:52 -08:00
Jeremy Kemper
1fcf32f8fe Eliminate warning with layout is unset 2009-11-10 15:48:03 -08:00
Jeremy Kemper
6480850d37 Revert "Eliminate warning with layout is unset"
This reverts commit 90be80361f26d717f9842170315dd8659f35429d.
2009-11-10 15:43:37 -08:00
Jeremy Kemper
be664392c0 Eliminate warning by initializing nil formats 2009-11-10 14:13:54 -08:00
Jeremy Kemper
90be80361f Eliminate warning with layout is unset 2009-11-10 14:13:21 -08:00
Joshua Peek
1004fcb767 Fixed AD assertion autoloads [#3470 state:resolved] 2009-11-09 21:38:01 -06:00
Xavier Noria
004db18cb0 String#bytesize is not needed for Ruby >= 1.8.7 2009-11-09 22:16:51 +01:00
Xavier Noria
f8e713f488 Object#tap is not needed for Ruby >= 1.8.7 2009-11-09 22:16:51 +01:00
Bryan Helmkamp
047007fa9d Silence warning: discarding old h 2009-11-09 15:44:36 -05:00
Bryan Helmkamp
afc129e270 Fix some Ruby warnings: `*' interpreted as argument prefix 2009-11-09 14:46:29 -05:00
Joshua Peek
c10f4ae01d Merge remote branch 'Fingertips/master' 2009-11-08 16:03:15 -06:00
Jeremy Kemper
a595abff21 Unknown :format param should result in empty request.formats 2009-11-08 12:12:58 -08:00
Yehuda Katz
e1b5e3cc70 Break up inflector to reduce the dependency burden on dependency-les methods like constantize. 2009-11-07 11:23:21 -08:00
Chris Hapgood
c2cfb20198 Share ActionView::TestCase's output_buffer with view for concat support.
[#3467 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-07 00:42:07 +01:00
Nathan Weizenbaum
cbded53671 When rendering layouts with blocks, use #capture to avoid assuming that the return value is the block's content.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2009-11-05 20:08:04 -08:00
Jeremy Kemper
1c047be0fc If class doesn't have a name, there's no implied layout name, so don't set up a _layout method 2009-11-05 16:12:02 -08:00
Yehuda Katz
b12f194c39 Update AC::Middleware to play better with the normal AC::Metal stack. This required stopping to use #call for non-rack-related stuff 2009-11-05 15:38:25 -08:00
Jeremy Kemper
a8ed10546d Ruby 1.9: don't assume params are US-ASCII. Hands off the encoding. 2009-11-04 16:27:54 -08:00
Joshua Peek
f950d0b4af Fix simple resource named routes for new routing dsl 2009-11-03 11:23:22 -06:00
Jeremy Kemper
b540eca588 Consolidate Object#to_param and #to_query core extensions 2009-11-02 17:50:12 -08:00
José Valim
976c264724 Extracted localized_cache.rb from ActionController, added it to AbstractController and made ActionMailer use it. 2009-11-01 02:23:49 +01:00
José Valim
0396004861 Add some basic render_test to AbstractController. 2009-11-01 02:23:48 +01:00
José Valim
0cf16ddb88 Improve AbstractController layouts coverage. 2009-11-01 02:23:48 +01:00
José Valim
43d5504f0a Move all render and layout pieces required in ActionMailer from ActionController to AbstractController. 2009-11-01 02:23:48 +01:00
José Valim
684c2dc208 Remove ActionMailer helpers and rely on AbstractController one. 2009-11-01 02:23:48 +01:00
José Valim
a9751a7034 Refactor ActionMailer layout and remove legacy one. 2009-11-01 02:23:47 +01:00
Yehuda Katz
51c24ae3e3 Caching refactoring 2009-10-29 00:44:12 -04:00
Yehuda Katz
8dcf91ca11 First pass at cleaning up action caching 2009-10-28 16:54:00 -04:00
José Valim
427a7385eb Make polymorphic_url work with symbols again and refactor it [#1384 status:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-28 14:13:48 -05:00
Yehuda Katz
654b33afc5 New semantics eliminate the need for __send__ 2009-10-28 01:43:46 -07:00
Yehuda Katz
c5e73b8976 Reduce TextTemplate cost for simple cases 2009-10-28 00:13:08 -07:00
Yehuda Katz
0b2dd7afd9 Reorganize CSRF a bit 2009-10-28 00:12:35 -07:00
Yehuda Katz
cbcb947b00 AS::Notifications.subscribe blocks are now yielded the arguments to pass to AS::Notifications::Event.new 2009-10-27 21:04:53 -07:00
Yehuda Katz
c3fa20883e #include should be #extend 2009-10-27 09:21:01 -07:00
Yehuda Katz
4653719aa6 Clean up flash a bit 2009-10-27 09:15:41 -07:00
Yehuda Katz
df06e0bd86 Clean up flash a bit 2009-10-26 23:11:52 -07:00
Yehuda Katz
2bdd8fa863 Clean up parameter logging some 2009-10-26 21:31:37 -07:00
Yehuda Katz
000d593621 Clean up and update cookies 2009-10-26 18:01:09 -07:00
Yehuda Katz
e1786ee6eb Fixes expires_now and cleans things up a bit 2009-10-26 17:32:42 -07:00
Yehuda Katz
d7499f8ee8 Extract #head into its own module and simplify it 2009-10-26 17:13:43 -07:00
Yehuda Katz
60cc86136b Base setup for config object in AC. 2009-10-26 15:47:08 -07:00
Joshua Peek
55ae53baad Fix rake routes method name output [#3422 state:resolved] 2009-10-26 11:23:39 -05:00
Joshua Peek
6083a87d63 Splat calls to_a not to_ary [#3423 state:resolved] 2009-10-26 11:16:17 -05:00
Joshua Peek
a840c8afbf Restore rake routes [#3402 state:resolved] 2009-10-24 18:08:54 -05:00
José Valim
9fbb2c571b Fix error_messages_for when instance variable names are given.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-21 11:18:36 -05:00
Joshua Peek
a5c82a9dfb Start rewriting some internal tests to use the new routing dsl 2009-10-20 16:03:55 -05:00
Joshua Peek
a1ce52effc New routing dsl 2009-10-20 12:31:23 -05:00
Joshua Peek
df68cae0c0 Group together all the old routing dsl logic 2009-10-20 10:46:27 -05:00
Joshua Peek
a74022ecd3 Move Routing into AD 2009-10-20 10:14:46 -05:00
Joshua Peek
a1df259074 Replace decaying routing internals w/ rack-mount 2009-10-19 23:32:17 -05:00
Jeremy Kemper
418ce487c4 Only undef to_json if it's defined 2009-10-19 18:46:59 -07:00
José Valim
cb87302689 Bring agnosticism to error_messages_for. 2009-10-17 13:03:28 -03:00
José Valim
2e37effd72 Unify class_inheritable_accessor and extlib_inheritable_accessor and allow responder to be set in the class level. 2009-10-17 12:54:03 -03:00
Yehuda Katz
7e9e370e03 Make encodings work with Erubis and 1.9 again 2009-10-16 17:28:44 -07:00
Joshua Peek
c1261b5484 Use Rails.application where we want a valid rack app 2009-10-16 19:04:28 -05:00
Carl Lerche
2110a524a4 Deprecate RAILS_ROOT in favor of Rails.root (which proxies to the application's object root) 2009-10-16 12:51:02 -07:00
Yehuda Katz
a565c19c5b Fix a bug where templates with locales were not being sorted correctly 2009-10-16 11:26:19 -07:00
Jeremy Kemper
71f7e75d95 Merge branch 'master' into orchestra 2009-10-15 17:36:54 -07:00
José Valim
2d7abe245e Renamed Orchestra to Notifications once again [#3321 state:resolved] 2009-10-15 18:51:51 -03:00
Yehuda Katz
e1490d4e4c Change config implementation in AV slightly 2009-10-15 14:41:59 -07:00
José Valim
a15e02d44a Unify benchmark APIs. 2009-10-15 18:19:25 -03:00
José Valim
af0d1fa892 Update Orchestra instrumentations and move part of logging to Orchestra. 2009-10-15 18:18:44 -03:00
José Valim
8b340ab2f6 Revert "Rename Orchestra to Notifications [#3321 state:resolved]"
This reverts commit 8cbf825425dc8ad3770881ea4e100b9023c69ce2.
2009-10-15 18:06:15 -03:00
Yehuda Katz
cb8b0f4a5a Make this less brittle and work on 1.8 2009-10-15 13:35:22 -07:00
Michael Koziarski
b1201792a7 Make the erubis implementation easier for plugins to change. 2009-10-15 17:54:01 +13:00
Michael Koziarski
cc1ad46ead Add a read-only method which plugin authors can use to determine if xss escaping.
This doesn't provide a way to turn off the escaping, but alternative template engine authors
can figure out what their default should be by calling this.  Avoids a messy version + plugin check.
2009-10-15 17:22:50 +13:00
Joshua Peek
bc1a18d7bd Punt on ConcurrentHash [#3322 state:resolved] 2009-10-14 19:53:52 -05:00
Joshua Peek
8cbf825425 Rename Orchestra to Notifications [#3321 state:resolved] 2009-10-14 19:50:36 -05:00
George Ogata
3de8b44b26 Make IntegrationTest::Runner propagate method_missing to ancestors.
Fixes RSpec integration example groups, which mixes its Matchers
module into ActiveSupport::TestCase.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-15 11:01:42 +13:00
Craig Smith
316f4704ea Test cases should see all the cookies, not just cookies that have been set in the controller.
Previously this example would always pass, even when cookies.delete was not called.

@request.cookies['foo'] = 'bar'
get :delete_cookie
assert_nil cookies['foo']

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2768 state:committed]
2009-10-15 10:58:55 +13:00
Michael Koziarski
1d01bad3ce Make sure non-escaped urls aren't considered safe 2009-10-15 09:58:35 +13:00
Michael Koziarski
5d5e34fa52 Use ERB::Util.h over CGI.escapeHTML as the former is safety aware and the latter isn't 2009-10-15 09:58:17 +13:00
Phil Darnowsky
1b3195b63c ActionView.url_for doesn't escape by default
ActionView::Helpers::UrlHelper#url_for used to escape the URLs it generated by
default.  This was most commonly seen when generating a path with multiple
query parameters, e.g.

  url_for(:controller => :foo, :action => :bar, :this => 123, :that => 456)

would return

  http://example.com/foo/bar?that=456&amp;this=123

escaping an ampersand that shouldn't be escaped.  This is both wrong and
inconsistent with the behavior of ActionController#url_for, and is changed.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-15 09:49:07 +13:00
Yehuda Katz
a41c6c35ca Start adding configuration to ActionView instead of using constants.
By using config rather than hardcoded constants, we can evolve the
  configuration system over time (we'd just need to update the config
  method with more robust capabilities and all consumers would get
  the capabilities with no code changes)
2009-10-14 13:36:41 -07:00
Jeffrey Hardy
a8dc9fd27b CookieJar#delete should return the key's value, consistent with a Hash
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-10-14 11:50:51 -07:00
Joshua Peek
21e7b84621 Callbacks, DeprecatedCallbacks = NewCallbacks, Callbacks 2009-10-12 22:15:43 -05:00
Joshua Peek
9bc8defe38 Use "run_callbacks :foo" since it is the public api for callbacks [#3329
state:resolved]
2009-10-12 21:58:49 -05:00
Yehuda Katz
b9ce8216fa Fix a bug where render :text could not handle yield :symbol. Fixes guides generation 2009-10-10 00:31:12 -10:00
Yehuda Katz
16a48a95e3 Fix issue with standalone ActionView 2009-10-09 00:55:00 -10:00
Yehuda Katz
2954cf1369 Avoid super in define_method for Rubinius 2009-10-09 00:54:12 -10:00
Yehuda Katz
ee37ff46e9 Get rid of constant name usage for stack trace help in favor of overriding #inspect and .name. 2009-10-09 00:53:48 -10:00
Carl Lerche
992c2db76c Finish porting over the initializers to the app object and fix all the tests 2009-10-08 18:12:28 -07:00
Joshua Peek
3b6bdfc105 API change: content_tag_for outputs prefixed class name 2009-10-08 14:13:49 -05:00
Carl Lerche
665c7ad29d Fix warning spew for 1.9 2009-10-08 10:58:04 -07:00
Michael Koziarski
c352ec060c error procs have to be safe too 2009-10-08 12:13:48 +13:00
Michael Koziarski
9415935902 Switch to on-by-default XSS escaping for rails.
This consists of:

  * String#html_safe! a method to mark a string as 'safe'
  * ActionView::SafeBuffer a string subclass which escapes anything unsafe which is concatenated to it
  * Calls to String#html_safe! throughout the rails helpers
  * a 'raw' helper which lets you concatenate trusted HTML from non-safety-aware sources (e.g. presantized strings in the DB)
  * New ERB implementation based on erubis which uses a SafeBuffer instead of a String

Hat tip to Django for the inspiration.
2009-10-08 09:31:20 +13:00
Yehuda Katz
3916f0340e Not calling a private method anymore 2009-10-07 00:33:13 -10:00
Yehuda Katz
e57197a967 Fix warning spew 2009-10-06 22:36:14 -10:00
Joshua Peek
b480da5cd6 Coerce all out going body parts to Strings 2009-10-05 13:58:43 -05:00
Joshua Peek
76d823677f Revert "Revert "Fix Dispatch.new so passenger works" as it broke the build"
This reverts commit 49b52cadc2e66c11a025e7719837ae77b3736046.
2009-10-05 09:17:51 -05:00
Michael Koziarski
49b52cadc2 Revert "Fix Dispatch.new so passenger works" as it broke the build
This reverts commit c97c31b096e627480b64403d1460065738941c3e.
2009-10-05 17:23:37 +13:00
Joshua Peek
c97c31b096 Fix Dispatch.new so passenger works 2009-10-04 12:45:53 -05:00
Joshua Peek
31319b471b NumberHelper depends on big decimal extensions 2009-10-03 22:06:25 -05:00
Carl Lerche
420004e030 Initialize a new instance of Rails.application during integration tests
This is to fix the AWDWR tests until the application object is refactored to be a singleton.
2009-09-30 12:39:26 -07:00
Erik Ostrom
8ffc2e3b8d Ported the new ActionView::TestCase from 2-3-stable to master [#3260
state:resolved]

The test case now mimicks the template environment more closely, so it's
possible to use render, load helper dependencies.

This also fixes assert_select, and similar assertions. Because view tests
and helpers generally don't render full templates assert_select looks
first in rendered and then in output_buffer to find the rendered output.

Additional `master'-only changes: Made the Action Pack Rakefile run the
ActionView::TestCase tests, and made ActionView::Rendering#_render_text
always return a string.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-28 13:31:30 -05:00
John Trupiano
c9318e9010 Introduce :almost keyword for distance_of_time_in_words. Make 1.75 days - 2 days return '2 days'.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3266 state:committed]
2009-09-28 14:37:31 +13:00
Jay Pignata
8ef1cd9733 Enhancing distance_of_time_in_words to prefix year output with over and about depending upon how many months have elapsed
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3106 state:committed]
2009-09-28 14:36:38 +13:00
Joshua Peek
a6757a02e1 Move middleware and route configuration from AC::Dispatcher to Rails application object 2009-09-26 21:59:28 -05:00
Joshua Peek
14866fa3d8 Allow setting a default application for all integration tests 2009-09-26 21:38:48 -05:00
Joshua Peek
acfeec5151 Allow integration test rack app to be set with "@app" ivar instead of using open_session 2009-09-26 20:51:05 -05:00
Joshua Peek
1f72700575 Move default middleware stack into initializer 2009-09-26 13:41:32 -05:00
Joshua Peek
ef58194129 Move Rails::Static into ActionDispatch 2009-09-26 11:37:42 -05:00
Joshua Peek
dfbd3b9409 Extract "parse_config" into AD 2009-09-25 21:40:55 -05:00
Joshua Peek
088ce2904d Fix generic url rewriter in integration tests 2009-09-25 11:10:39 -05:00
Jeremy Kemper
0bd6e933c0 Restore split between require-time and runtime load path mungery. Simplifies vendor requires. 2009-09-24 18:38:18 -07:00
Yehuda Katz + Carl Lerche
f0dd77c6be Move railties/lib/* into railties/lib/* 2009-09-24 16:11:41 -07:00
Joshua Peek
610b81beca Clean up log output for rendered templates 2009-09-24 12:30:13 -05:00
Joshua Peek
9f96708f53 Resurrect AC::Benchmarking [#3140 state:resolved] 2009-09-24 12:13:09 -05:00
Joshua Peek
3fb623fa90 SessionRestoreError belongs in AD 2009-09-23 23:37:31 -05:00
Joshua Peek
542ddde5d4 Move helpers specific to functional tests out of TestProcess into AC::TestCase 2009-09-23 23:03:24 -05:00
Joshua Peek
4a55d1de8d Move integration test runner into ActionDispatch 2009-09-23 22:38:19 -05:00
José Valim
2407479603 Fixes Sam Ruby tests suite.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-21 17:56:24 -07:00
José Valim
a0233dd3b2 Use NewCallbacks on ActionDispatch::Callbacks. 2009-09-20 10:56:38 -03:00
José Valim
7cc1c2e71d Add Orchestra instrumentation to fragment and page caching. 2009-09-20 10:56:38 -03:00
José Valim
8f47f311b7 Instrument process_action, render and sql. 2009-09-20 10:56:38 -03:00
Yehuda Katz
81c421386c 1.9 fix for changes to #to_s. By Sam Ruby. [#3228 state:resolved] 2009-09-18 10:35:42 -07:00
Joshua Peek
23e72d4cc8 Forward all methods to delayed log 2009-09-16 22:34:44 -05:00
José Valim
befec8a0d8 Remove unused code in ActionView.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-09-15 16:18:10 -07:00
Joshua Peek
52aeb8d2e7 Beef up AD::Rescue to replace global exception handling lost in ApplicationController 2009-09-15 16:33:15 -05:00
Joshua Peek
90d7ae23c6 Remove global exception catching from ApplicationController.
It was severely broken since it was ported to NewBase and is causing problems with normal exception catching. A replacement is coming soon.
2009-09-15 10:05:46 -05:00
Jeremy Kemper
b8e914709c Require active_support after autoload setup 2009-09-14 13:04:43 -07:00
Jeremy Kemper
af68eb99c1 Uses extlib_inheritable_accessor 2009-09-14 13:04:43 -07:00
Joshua Peek
b2f0b8cbda Rollback AS bundler work and improve activation of vendored dependencies 2009-09-13 22:55:46 -05:00
Joshua Peek
67eb892e94 AV::UrlHelper depends on Array#second 2009-09-13 17:25:40 -05:00
Joshua Peek
8491b77f55 Omit PATH_INFO in integration test so rack mock will properly override it 2009-09-13 17:15:35 -05:00
Joshua Peek
a01bf41c61 Lazy require memcache for session middleware 2009-09-13 15:30:55 -05:00
Joshua Peek
a9f5f4bb45 Don't force test suite to use bundler 2009-09-13 12:42:13 -05:00
Michael Koziarski
81cba78e9e Merge commit 'alloy/master-nested_attributes_and_autosave' 2009-09-13 10:32:24 +12:00