Hi,
I'm a Merb newbie and probably doing something wrong when trying to
access my application resources using json format.
Versions:
ruby: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
gem: 1.3.1
merb: merb 1.0.3
Commands:
$ merb-gen app test
$ cd test
$ merb-gen resource person
$ vi app/models/person.rb
$ cat app/models/person.rb
class Person
include DataMapper::Resource
property :id, Serial
property :name, String
end
$ merb -i
irb(main):001:0> DataMapper.auto_migrate!
~ DROP TABLE IF EXISTS "people"
~ DROP TABLE IF EXISTS "sessions"
~ DROP TABLE IF EXISTS "users"
~ PRAGMA table_info('users')
~ SELECT sqlite_version(*)
~ CREATE TABLE "users" ("id" INTEGER NOT NULL PRIMARY KEY
AUTOINCREMENT, "login" VARCHAR(50), "crypted_password" VARCHAR(50),
"salt" VARCHAR(50))
~ PRAGMA table_info('sessions')
~ CREATE TABLE "sessions" ("session_id" VARCHAR(32) NOT NULL, "data"
TEXT DEFAULT 'BAh7AA== ', "created_at" DATETIME, PRIMARY
KEY("session_id"))
~ PRAGMA table_info('people')
~ CREATE TABLE "people" ("id" INTEGER NOT NULL PRIMARY KEY
AUTOINCREMENT, "name" VARCHAR(50))
=> [User, Merb::DataMapperSessionStore, Person]
irb(main):002:0> p = Person.create(:name => "Marvin")
~ INSERT INTO "people" ("name") VALUES ('Marvin')
=> #<Person id=1 name="Marvin">
irb(main):003:0> p.to_json
=> "\"#<Person:0xb56f7394>\""
irb(main):004:0>
Whem adding "provides :json" on app/controllers/people.rb the response
of accessing http://localhost:4000/people/1.json is the same as the
result of calling to_json above.
I installed the gems json and pure_json, but the result is the same.
I tested on Linux and Mac.
Regards,
Lucindo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---