Commit Graph

4156 Commits

Author SHA1 Message Date
Piotr Sarnacki
e6ab0d56cf Lazy load default_form_builder if it's passed as a string
closes #3341
2012-04-28 22:32:46 -07:00
Andrew White
5c18bdca32 Merge session arg with existing session instead of overwriting
This may break existing tests that are asserting the whole session contents
but should not break existing tests that are asserting individual keys - e.g:

class SomeControllerTest < ActionController::TestCase
  setup do
    session['user_id'] = 1
  end

  test "some test" do
    get :some_action, nil, { 'another_var' => 2 }

    # This assertion will now fail
    assert_equal({ 'another_var' => 2 }, session)

    # This assertion will still pass
    assert_equal 2, session['another_var]
  end
end

Fixes #1529.
2012-04-28 22:36:16 +01:00
Sergey Nartimov
67e8004ffd remove calls to deprecated find(:first) in actionpack test suite 2012-04-26 21:50:35 +03:00
Yehuda Katz
47be2f101c Fix the build 2012-04-25 16:43:01 -05:00
Jeremy Kemper
bb0906e2d7 Merge pull request #5980 from gazay/valid_ips
Remote ip logic and validation. IPv6 support.
2012-04-25 05:18:04 -07:00
Alexey Gaziev
6da2bc5fcc Valid ips v4 and v6. Right logic for working with X-FORWARDED-FOR header and tests. 2012-04-25 14:50:59 +04:00
Jose and Yehuda
56cdc81c08 Remove default match without specified method
In the current router DSL, using the +match+ DSL
method will match all verbs for the path to the
specified endpoint.

In the vast majority of cases, people are
currently using +match+ when they actually mean
+get+. This introduces security implications.

This commit disallows calling +match+ without
an HTTP verb constraint by default. To explicitly
match all verbs, this commit also adds a
:via => :all option to +match+.

Closes #5964
2012-04-24 22:52:26 -05:00
Alexey Vakhov
7322bd45f0 Use leap years trick in distance_of_time_in_words only for distances between real date points 2012-04-24 15:58:02 +04:00
Marcelo Casiraghi
5fdd4cd9e4 fixed non matching documentation behaviour with method semantics on distance_of_time_in_words 2012-04-24 15:56:35 +04:00
Alexey Vakhov
ff5b0d699d Distance of time in words should work correct if from time > to_time 2012-04-24 15:56:35 +04:00
Aaron Patterson
ed8108300b Merge pull request #5865 from tiegz/minor_fixes
Catch nil.to_sym errors in partial_renderer, and raise ArgumentError instead
2012-04-20 16:23:27 -07:00
Rafael Mendonça França
4b85acba43 Remove unused test code.
ActionController::RoutingError are raised in router execution time and can not be
rescued in a controller.
2012-04-16 23:38:31 -03:00
Tieg Zaharia
5d8d639f00 converting some tests to assert_raises, and DRY'ing retrieve_variable changes 2012-04-16 15:33:15 -04:00
Tieg Zaharia
dfab28b2ca catch nil.to_sym errors in partial_renderer, and raise ArgumentError instead 2012-04-16 13:56:32 -04:00
Santiago Pastorino
1db54dffaf Merge pull request #5746 from jmbejar/index_method_form_builder
Add method FormBuilder#index
2012-04-11 19:43:50 -07:00
Jorge Bejar
47cbfbb98a Add index method to FormBuilder. Useful when you use field_for and need to know the index number into the iteration. 2012-04-11 23:11:38 -03:00
Frankie Roberto
283133a59c Adding itemscope to list of boolean attributes.
'itemscope' is defined within HTML5 for use in microdata markup. See
http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.ht
ml#attr-itemscope
2012-04-09 12:23:46 +01:00
Santiago Pastorino
4c1dcb0537 Merge pull request #5783 from rafaelfranca/default_url_options
Document that default_url_options must return a hash with symbolized keys
2012-04-08 20:10:14 -07:00
Rafael Mendonça França
9efe01ef0d default_url_options does not receive one argument anymore 2012-04-08 23:44:00 -03:00
Santiago Pastorino
500c9a161c Revert "Merge pull request #5750 from ahoward/master"
This reverts commit 174cf8b22064c3999dfa685014d5b31ac993bb54, reversing
changes made to 7ecd6a731bd60665bc6de94095137f0b2c4ada2a.
The reverted commit improved the performance in the wrong place, now we
have added this 6ddbd1844a6fd6aca2992f5f75c9f605cf89808f improvement.
2012-04-08 22:44:37 -03:00
Jeremy Kemper
0032da1b3e Merge pull request #5748 from ai/no_type_in_html5
Remove unnecessary in HTML 5 type attribute with default value
2012-04-08 06:56:44 -07:00
Rafael Mendonça França
ddbd1e4adb Make url_for work when option is nil and default_url_options has
stringified keys
2012-04-05 15:14:00 -03:00
Aaron Patterson
174cf8b220 Merge pull request #5750 from ahoward/master
mo fasta and mo betta the url_for
2012-04-05 09:31:39 -07:00
José Valim
91cb99e9e4 Merge pull request #4446 from ayamomiji/patch-1
prevent the cache sweeper ignores NoMethodError
2012-04-05 06:20:02 -07:00
Andrey A.I. Sitnik
f3fb416b89 Remove unnecessary in HTML 5 type attribute with default value 2012-04-05 15:32:37 +04:00
ara.t.howard
697991a201 carefully and quickly merge url_for options 2012-04-04 16:28:19 -06:00
Sergey Nartimov
e3d1585c8f add type option to atom feed entry builder
closes #5672
2012-04-01 20:07:34 +03:00
José Valim
eb154c5299 Merge pull request #5691 from avakhov/form-label-block
Block version of label should wrapped in field_with_errors in case of error
2012-04-01 04:45:10 -07:00
Alexey Vakhov
7f6bb2d86d Tests :if option of force_ssl method 2012-04-01 09:44:49 +04:00
Alexey Vakhov
889bb4b786 Block version of label should wrapped in field_with_errors in case of error 2012-04-01 08:53:55 +04:00
Santiago Pastorino
1141f71601 Remove the leading \n added by textarea on assert_select 2012-03-30 11:40:23 -03:00
José Valim
e51322a34b Merge pull request #5625 from nertzy/prefix_partial_path_with_controller_namespace
Add config option to turn off prefixing partial path with controller namespace
2012-03-28 23:51:34 -07:00
Santiago Pastorino
c4d90e4204 Merge pull request #5359 from avakhov/missed-commits-from-3-2-stable
Missed commits from 3-2-stable
2012-03-28 20:32:09 -07:00
ayaya
2ac67358a3 prevent the cache sweeper ignores NoMethodError 2012-03-29 11:09:42 +08:00
Grant Hutchins
18d275ada1 Make controller namespace partial prefix optional
config.action_view.prefix_partial_path_with_controller_namespace

This allows you to choose to render @post using
/posts/_post.erb instead of /admin/posts/_post.erb
inside Admin::PostsController.
2012-03-28 20:21:46 -04:00
Grant Hutchins
a0e83d5af7 Test that render gets correct exact template name 2012-03-28 19:42:20 -04:00
Santiago Pastorino
f0268d56af Set proper rendered_format when doing render :inline
Closes #5632
2012-03-28 18:53:09 -03:00
Joe Van Dyk
b9cbadf1e3 datetime_select should work with -/+ infinity dates 2012-03-28 23:06:52 +04:00
José Valim
dd0275e463 Add a test case for layout nil. 2012-03-28 23:06:52 +04:00
Piotr Sarnacki
5a5ca14cb2 Cover one more case in auth_token and remote forms
If embedding auth_token in remote forms is off and we
pass a value for auth_token it should respect it.
2012-03-28 18:03:16 +02:00
Piotr Sarnacki
128cfbdf4d config.action_view.embed_authenticity_token_in_remote_forms is true by default
Changed default value for `config.action_view.embed_authenticity_token_in_remote_forms`
to `false`. This change breaks remote forms that need to work also without javascript,
so if you need such behavior, you can either set it to `true` or explicitly pass
`:authenticity_token => true` in form options
2012-03-28 18:03:16 +02:00
Piotr Sarnacki
805b15ff35 Added config.action_view.embed_authenticity_token_in_remote_forms
There is a regression introduced in 16ee611fa, which breaks
remote forms that should also work without javascript. This commit
introduces config option that allows to configure this behavior
defaulting to the old behavior (ie. include authenticity token
in remote forms by default)

Conflicts:

	actionpack/CHANGELOG.md
2012-03-28 18:03:15 +02:00
Aaron Suggs
0c525f68f2 Add test for default_url_options[:port] 2012-03-28 13:31:37 +02:00
Jeremy Kemper
da5f65676e Merge pull request #5621 from rafaelfranca/fix-2492-master
Fix label_tag to merge the options hash with the object hash
2012-03-27 16:15:11 -07:00
Rafael Mendonça França
32763a8244 Check if the options hash already exists and merge it with the another
hash.

Closes #2492 and #5615
2012-03-27 19:45:51 -03:00
Santiago Pastorino
33164c8f14 Merge pull request #5620 from jcoleman/textarea-newline-fix-breaks-haml-master
Don't break Haml with textarea newline fix. (master)
2012-03-27 14:16:04 -07:00
James Coleman
1438e0eb06 Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)

Also fix 6 more tests that didn't yet have the newline expectation.
2012-03-27 17:04:08 -04:00
Jens Fahnenbruck
96b72efc00 adds delegetion for eof? to AD::Http::UploadedFile
if you want to read the file you may need to ask if there is something
to read from
2012-03-27 22:53:33 +02:00
Andrey Samsonov
6ce0a6de7e Fixing issue #2492 for master branch. ActionView::Base.field_error_proc doesn't call for label.
objectify_options method should be applied to the proper options arg.

See explanation and example of the bug - https://github.com/kryzhovnik/rails_field_error_proc_bug_example
2012-03-27 17:12:07 +04:00
Piotr Sarnacki
67b2404cf9 If partial is rendered in controller, grab format from template
Previously `rendered_format` was set only based on mime types
passed in Accept header, which was wrong if first type from
Accept was different than rendered partial. The fix is to simply
move setting rendered_format to the place where template
is available and grab format from the template. If it fails
we can fallback to formats passed by Accept header.
2012-03-27 12:14:56 +02:00