Permalink
Browse files

Using .underscore instead of .downcase on model class names. We want …

…user_session_foo, not usersession_foo.
  • Loading branch information...
1 parent ee295c5 commit 8c8625e76beb84ade52e4469521341f1abdeda00 @augustl committed Jul 3, 2009
Showing with 23 additions and 2 deletions.
  1. +1 −1 lib/live_validations/adapter_base.rb
  2. +14 −0 test/general_adapter_test.rb
  3. +8 −1 test/test_helper.rb
@@ -78,7 +78,7 @@ def utilizes_inline_javascript?
# The DOM prefix, e.g. "post" for Post. Used to reference DOM ids
# and DOM names, such as "post[title]" and "post_title".
def prefix
- active_record_instance.class.name.downcase
+ active_record_instance.class.name.underscore
end
def handle_form_for_options(options)
@@ -117,4 +117,18 @@ def test_various_types_of_form_helpers
assert_html "script[type=text/javascript]"
end
+
+ def test_model_with_multiple_words
+ LiveValidations.use :jquery_validations
+ UserSession.validates_presence_of :login
+
+ render <<-eof
+ <% form_for UserSession.new, :live_validations => true do |f| %>
+ <%= f.text_field :login %>
+ <% end %>
+ eof
+
+ assert_html "input#user_session_login"
+ assert @rendered_view.include?(%{"user_session[login]":})
+ end
end
View
@@ -18,11 +18,14 @@ class Post < ActiveRecord::Base
has_many :comments, :order => "position"
end
+class UserSession < ActiveRecord::Base
+end
+
ActiveSupport::Deprecation.silenced = true
ActiveRecord::Migration.verbose = false
ActionController::Routing::Routes.draw do |map|
- map.resources :posts
+ map.resources :posts, :user_sessions
map.connect ":controller/:action/:id"
end
@@ -61,6 +64,10 @@ def reset_database
t.string :title
t.text :excerpt, :body
end
+
+ create_table :user_sessions, :force => true do |t|
+ t.string :login
+ end
end
end
end

0 comments on commit 8c8625e

Please sign in to comment.