Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed error on saving Mongoid habtm object

  • Loading branch information...
commit 1ce645ebdc19077622499ea1bb1bbcf0c1c1f6a3 1 parent 5c4e6eb
@mshibuya authored
View
2  lib/rails_admin/config/fields/types/serialized.rb
@@ -13,7 +13,7 @@ class Serialized < RailsAdmin::Config::Fields::Types::Text
end
def parse_input(params)
- params[name] = (params[name].blank? ? nil : YAML.load(params[name]))
+ params[name] = (params[name].blank? ? nil : YAML.load(params[name])) if params[name].is_a?(::String)
end
end
end
View
13 spec/integration/basic/create/rails_admin_basic_create_spec.rb
@@ -138,4 +138,17 @@
should have_content("Player failed to be created. Player is cheating")
end
end
+
+ describe "creation of Mongoid habtm model object" do
+ before(:each) do
+ visit new_path(:model_name => "tag")
+ fill_in "tag[name]", :with => "Funny"
+ click_button "Save"
+ @tag = RailsAdmin::AbstractModel.new("Tag").first
+ end
+
+ it "should create an object with correct attributes" do
+ @tag.name.should eql("Funny")
+ end
+ end
end
View
1  spec/spec_helper.rb
@@ -70,6 +70,7 @@ def password_digest(password)
Author.delete_all
Article.delete_all
MongoidFieldTest.delete_all
+ Tag.delete_all
login_as User.create(
:email => "username@example.com",
:password => "password"
Please sign in to comment.
Something went wrong with that request. Please try again.