If you have the need to do a lot of XML processing you are better off staying away from rails completely. The State of SOAP on rails is a mess to the point of being practically unusable. The XML and json deserialization is like playing russian roulette with five bullets in the chamber. Try it yourself. u = User.find(1). xml = u.to_xml ... Change the xml. u.from_xml(xml) Doesn''t work. Same with json. Doesn''t work. Half the time from_xml can''t parse the xml to_xml put out. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-27 21:47 UTC
Re: Neither from_xml nor from_Json work in rails 2.1
On Nov 27, 9:38 pm, "Tim Uckun" <timuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you have the need to do a lot of XML processing you are better off > staying away from rails completely. The State of SOAP on rails is a > mess to the point of being practically unusable. The XML and json > deserialization is like playing russian roulette with five bullets in > the chamber. > > Try it yourself. > > u = User.find(1). > xml = u.to_xml > > ... Change the xml. > > u.from_xml(xml) > > Doesn''t work. > > Same with json. Doesn''t work. >Minus your mysterious ''change the xml'' that worked for me.If you could produce a more precise example (or at least elaborate on "Doesn''t work" (raises an exception, does nothing, has the wrong attributes, something else...) you might get a more helpful response. Fred> Half the time from_xml can''t parse the xml to_xml put out.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Minus your mysterious ''change the xml'' that worked for me.If you could > produce a more precise example (or at least elaborate on "Doesn''t > work" (raises an exception, does nothing, has the wrong attributes, > something else...) > you might get a more helpful response.Let''s see..... u = User.find(3) => #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 4, address_id: nil>>> u.to_xml=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n <activated-at type=\"datetime\">2008-11-19T22:12:07Z</activated-at>\n <activation-code>bab0c2bc67d43b6871005559b114b9b62b7b70bb</activation-code>\n <address-id type=\"integer\" nil=\"true\"></address-id>\n <company-id type=\"integer\">3</company-id>\n <crypted-password>b695db100847aa269fb477443a289d875cf2e001</crypted-password>\n <email>tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org</email>\n <enabled type=\"boolean\">true</enabled>\n <id type=\"integer\">3</id>\n <lock-version type=\"integer\">4</lock-version>\n <login>tm_user</login>\n <password-reset-code nil=\"true\"></password-reset-code>\n <remember-token nil=\"true\"></remember-token>\n <remember-token-expires-at type=\"datetime\" nil=\"true\"></remember-token-expires-at>\n <salt>1e3a4ba1ccb233c2bbd92c3bdbb917307523671b</salt>\n <timezone>UTC</timezone>\n</user>\n" Change the XML. Change the timezone from UTC to ABC a = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n <activated-at type=\"datetime\">2008-11-19T22:12:07Z</activated-at>\n <activation-code>bab0c2bc67d43b6871005559b114b9b62b7b70bb</activation-code>\n <address-id type=\"integer\" nil=\"true\"></address-id>\n <company-id type=\"integer\">3</company-id>\n <crypted-password>b695db100847aa269fb477443a289d875cf2e001</crypted-password>\n <email>tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org</email>\n <enabled type=\"boolean\">true</enabled>\n <id type=\"integer\">3</id>\n <lock-version type=\"integer\">4</lock-version>\n <login>tm_user</login>\n <password-reset-code nil=\"true\"></password-reset-code>\n <remember-token nil=\"true\"></remember-token>\n <remember-token-expires-at type=\"datetime\" nil=\"true\"></remember-token-expires-at>\n <salt>1e3a4ba1ccb233c2bbd92c3bdbb917307523671b</salt>\n <timezone>ABC</timezone>\n</user>\n" Apply it back to the record.>> u.from_xml(a)> u.from_xml(a)=> #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 4, address_id: nil> Mmmmm. timezone is still UTC. Let''s save it.>> u.save=> true>> u=> #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 5, address_id: nil> Looks like the time zone never got changed. Let''s try with json>> u.to_json=> "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"UTC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user\", \"email\": \"tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org\"}}">> j = "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user\", \"email\": \"tm_user@panztelcom\"}}"=> "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user\", \"email\": \"tm_user@panztelcom\"}}">> j=> "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user\", \"email\": \"tm_user@panztelcom\"}}">> u.from_json(j)=> #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 5, address_id: nil>>> u.save=> true>> u=> #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 6, address_id: nil>>>Exact same story. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-27 22:21 UTC
Re: Neither from_xml nor from_Json work in rails 2.1
On Nov 27, 10:10 pm, "Tim Uckun" <timuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Minus your mysterious ''change the xml'' that worked for me.If you could > > produce a more precise example (or at least elaborate on "Doesn''t > > work" (raises an exception, does nothing, has the wrong attributes, > > something else...) > > you might get a more helpful response. > > Let''s see..... >Is timezone a protected attribute (as in attr_protected or not on the list given to attr_accessible) ? Is the accessor function timezone= overwridden ? Does it work if you change other attributes? Fred> u = User.find(3) > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 4, address_id: nil> > > >> u.to_xml > > => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n > <activated-at type=\"datetime\">2008-11-19T22:12:07Z</activated-at>\n > <activation-code>bab0c2bc67d43b6871005559b114b9b62b7b70bb</activation-code> \n > <address-id type=\"integer\" nil=\"true\"></address-id>\n > <company-id type=\"integer\">3</company-id>\n > <crypted-password>b695db100847aa269fb477443a289d875cf2e001</crypted-passwor d>\n > <email>tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org</email>\n <enabled > type=\"boolean\">true</enabled>\n <id type=\"integer\">3</id>\n > <lock-version type=\"integer\">4</lock-version>\n > <login>tm_user</login>\n <password-reset-code > nil=\"true\"></password-reset-code>\n <remember-token > nil=\"true\"></remember-token>\n <remember-token-expires-at > type=\"datetime\" nil=\"true\"></remember-token-expires-at>\n > <salt>1e3a4ba1ccb233c2bbd92c3bdbb917307523671b</salt>\n > <timezone>UTC</timezone>\n</user>\n" > > Change the XML. Change the timezone from UTC to ABC > > a = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n > <activated-at type=\"datetime\">2008-11-19T22:12:07Z</activated-at>\n > <activation-code>bab0c2bc67d43b6871005559b114b9b62b7b70bb</activation-code> \n > <address-id type=\"integer\" nil=\"true\"></address-id>\n > <company-id type=\"integer\">3</company-id>\n > <crypted-password>b695db100847aa269fb477443a289d875cf2e001</crypted-passwor d>\n > <email>tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org</email>\n <enabled > type=\"boolean\">true</enabled>\n <id type=\"integer\">3</id>\n > <lock-version type=\"integer\">4</lock-version>\n > <login>tm_user</login>\n <password-reset-code > nil=\"true\"></password-reset-code>\n <remember-token > nil=\"true\"></remember-token>\n <remember-token-expires-at > type=\"datetime\" nil=\"true\"></remember-token-expires-at>\n > <salt>1e3a4ba1ccb233c2bbd92c3bdbb917307523671b</salt>\n > <timezone>ABC</timezone>\n</user>\n" > > Apply it back to the record. > > >> u.from_xml(a) > > u.from_xml(a) > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 4, address_id: nil> > > Mmmmm. timezone is still UTC. > > Let''s save it. > > >> u.save > => true > >> u > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 5, address_id: nil> > > Looks like the time zone never got changed. > > Let''s try with json > > >> u.to_json > > => "{\"user\": {\"salt\": > \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": > \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, > \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", > \"password_reset_code\": null, \"lock_version\": 5, > \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", > \"timezone\": \"UTC\", \"id\": 3, \"enabled\": true, \"address_id\": > null, \"remember_token\": null, \"company_id\": 3, \"login\": > \"tm_user\", \"email\": \"tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org\"}}">> j = "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user\", \"email\": \"tm_user@panztelcom\"}}" > > => "{\"user\": {\"salt\": > \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": > \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, > \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", > \"password_reset_code\": null, \"lock_version\": 5, > \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", > \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": > null, \"remember_token\": null, \"company_id\": 3, \"login\": > \"tm_user\", \"email\": \"tm_user@panztelcom\"}}">> j > > => "{\"user\": {\"salt\": > \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": > \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, > \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", > \"password_reset_code\": null, \"lock_version\": 5, > \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", > \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": > null, \"remember_token\": null, \"company_id\": 3, \"login\": > \"tm_user\", \"email\": \"tm_user@panztelcom\"}}">> u.from_json(j) > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 5, address_id: nil>>> u.save > => true > >> u > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 6, address_id: nil> > > > > Exact same story.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Is timezone a protected attribute (as in attr_protected or not on the > list given to attr_accessible) ?No. It''s changeable by the web GUI too. Also if that was the case you''d expect the validation to throw up an error right?> Is the accessor function timezone= overwridden ? Does it work if you > change other attributes?No. It also doesn''t work if you attempt to change other attributies. Change the login field to "tm_user"changed">> j = "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user_changed\", \"email\": \"tm_user@panztelcom\"}}">> u.from_json(j)=> #<User id: 3, company_id: 3, login: "tm_user", email: "tm_user-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: "b695db100847aa269fb477443a289d875cf2e001", salt: "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", remember_token: nil, remember_token_expires_at: nil, activation_code: "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 22:12:07", password_reset_code: nil, enabled: true, created_at: "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", lock_version: 7, address_id: nil>>>Nope no change. Let''s save it.>> u.save=> true>> u.login=> "tm_user">>Didn''t change. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-27 22:34 UTC
Re: Neither from_xml nor from_Json work in rails 2.1
On Nov 27, 10:26 pm, "Tim Uckun" <timuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Is timezone a protected attribute (as in attr_protected or not on the > > list given to attr_accessible) ? > > No. It''s changeable by the web GUI too. Also if that was the case > you''d expect the validation to throw up an error right? >actually no. if you try to mass assign a attr_protected attribute then it just ignores it (you''ll get a warning in the logs).> > Is the accessor function timezone= overwridden ? Does it work if you > > change other attributes? > > No. It also doesn''t work if you attempt to change other attributies. > > Change the login field to "tm_user"changed" >weird. I''d check your logs in case there''s a warning in there. This sort of thing could happen if you had accidentally overwritten an important activerecord method (eg if you had an association called attributes) but hard to say without seeing more. you might find out more if you were able to reduce this to a minimal example (or work the other way - start with a fresh rails app & model and add stuff until it breaks) Fred> >> j = "{\"user\": {\"salt\": \"1e3a4ba1ccb233c2bbd92c3bdbb917307523671b\", \"activated_at\": \"2008-11-19T22:12:07Z\", \"remember_token_expires_at\": null, \"crypted_password\": \"b695db100847aa269fb477443a289d875cf2e001\", \"password_reset_code\": null, \"lock_version\": 5, \"activation_code\": \"bab0c2bc67d43b6871005559b114b9b62b7b70bb\", \"timezone\": \"ABC\", \"id\": 3, \"enabled\": true, \"address_id\": null, \"remember_token\": null, \"company_id\": 3, \"login\": \"tm_user_changed\", \"email\": \"tm_user@panztelcom\"}}" > >> u.from_json(j) > > => #<User id: 3, company_id: 3, login: "tm_user", email: > "tm_u...-D0oEdmCROLxBDgjK7y7TUQ@public.gmane.org", crypted_password: > "b695db100847aa269fb477443a289d875cf2e001", salt: > "1e3a4ba1ccb233c2bbd92c3bdbb917307523671b", timezone: "UTC", > remember_token: nil, remember_token_expires_at: nil, activation_code: > "bab0c2bc67d43b6871005559b114b9b62b7b70bb", activated_at: "2008-11-19 > 22:12:07", password_reset_code: nil, enabled: true, created_at: > "2008-11-19 22:12:07", updated_at: "2008-11-19 22:12:07", > lock_version: 7, address_id: nil> > > > > Nope no change. Let''s save it. > > > > >> u.save > => true > >> u.login > => "tm_user" > > Didn''t change.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---