Hi all,
Since it is now possible to build jruby version of data_objects
(http://www.datamapper.org/doku.php?
id=jruby:contribute#where_to_start) I made one small merb application
and tried it
with do_mysql driver in two variants: mri and jruby.
And I ran into encoding problem for jruby version.
For table:
CREATE TABLE `tags` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
I have a corresponding model class:
class Tag
include DataMapper::Resource
property :id, Serial
property :name, String
end
My connection parameters:
development:
adapter: mysql
database: test_development
username: root
password: 'secret'
host: localhost
port: 3306
Then I made a simple controller that allowed to create new tags and
view a list of them:
class Tags < Application
def index
@tags = Tag.all
render
end
def new
@tag = Tag.new
render
end
def create
@tag = Tag.new(params[:tag])
if @tag.save
render
else
render :new
end
end
....
Then I started playing with it.
I ran into a problem when I was storing Cyrillic symbols.
Here is a log messages for jruby version:
merb : worker (port 4000) ~ Params: {"tag"=>{"name"=>"Бум"},
"submit"=>"Create", "controller"=>"tags", "action"=>"create",
"id"=>nil, "format"=>nil}
~ (1) INSERT INTO `tags` (`name`) VALUES ('�?�?м')
merb : worker (port 4000) ~
{:before_filters_time=>0.000341, :after_filters_time=>0.000118,
:action_time=>0.745652, :dispatch_time=>0.765797}
As you see some symbols are treated incorrectly.
The mri version works fine.
What am I missing. Are there some additional connection params?
Best regards,
Nick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---