similar to: How to get hold of a patch

Displaying 20 results from an estimated 4000 matches similar to: "How to get hold of a patch"

2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all, I am getting ActiveRecord to produce XML with render :xml => @user.to_xml However, on the client end it is a bit annoying for me to deal with attributes like first-name. I would much rather have first_name. Is there any way for me to turn off the behavior of converting _ to -? This seems to be done by a call to dasherize inside the to_xml of
2009 Jan 21
1
AR to_xml problem with associations, Builder::XmlMarkup#to_a
When I do a to_xml(with a block) on an association of a model I got a Builder::XmlMarkup#to_ary should return Array Example that does not work. @intervenant = Intervenant.find(params[:id]) output = @intervenant.to_xml( :skip_types => false, :dasherize => false) do |xml| @intervenant.individu.to_xml( :builder => xml, :skip_instruct => true, :skip_types => false,
2006 Aug 15
2
to_xml and underscores
hi, i am looking for a solution whereupon calling myEntityObject.to_xml does not convert my attributes containing underscores into hyphens. at the moment an attribute named "my_own_attribute" is converted into <my-own-attribute>. does anybody have an idea how to change that and have to_xml generate <my_own_attribute> thanks ciao robertj -- Posted via
2006 Dec 03
0
How to best change the default value of dasherize (using Edge Rails, and knowing about :dasherize => false)?
Hi all, I''m trying to turn off dasherize in all cases, since converting underscores to hyphens breaks the way that I want to handle XML (with E4X in Flex 2). I''ve read the other threads about dasherize on this list. I''m on Edge Rails, so I can successfully turn off dasherize for a single usage with something like render :xml => @task.to_xml(:dasherize => false)
2009 Jan 09
2
Confused about to_xml() in ActiveRecord::Base subclass
Since all my efforts to control how to_xml() is formatting dates has failed, I''m now considering writing my own to_xml(). However, from the limited examples I''ve found, I just don''t understand how to actually reference the columns for the records in my record set. Here''s a simplified view of my ActiveRecord object: class Errors < ActiveRecord::Base
2008 Apr 22
0
Overriding to_xml() - Why Does This Work?
In Chapter 5 of his book, Flexible Rails, Peter Armstrong''s leads his readers through an exercise to override the behavior of to_xml() in ActiveRecord objects so that :dasherize would be false by default. I found his solution inelegant. I came up with a more elegant one, and it seems to work. All I did was add the following to the very end of myapp/config/ environment.rb: class
2008 Nov 10
3
to_xml and helper methods
Hi, I have an array with objects and I want to generate an XML like: <objects> <object> <category_id>1</category_id> <helper-method>result 1</helper-method> </object> <object> <category_id>2</category_id> <helper-method>result 2</helper-method> </object> </objects> The helper
2009 Apr 18
1
RESTful posting
I''m implementing a Rails front end to a Windows system by using RESTful web services to send data back and forth. Luckyly all the business objects in the Windows system know how to serialize themselves into XML so it''s not too complicated. But when I looked at the XML that gets sent back to the service in a POST when you do a myresource.save, all the fields that had underscores
2007 Oct 24
7
NoMethodError when creating new ActiveRecord model object
the strangest thing is happening...i''m not getting this every time, maybe 1/3 of the time, identical requests... i''m a rails newbie, but i think i''m trying pretty standard stuff, this is an excerpt from the log: ---------------------- Processing EmailConfigsController#edit_xml (for 127.0.0.1 at 2007-10-24 15:52:09) [GET] Session ID: 6630219819a2da423d8c48a259dd28d6
2006 Oct 13
3
How to get a count of line_items
I am fairly new to Rails, and I am having difficulty in forgetting the old way of developing and using the Rails way. This is my question, using orders and line_items as an example. An order has_many line_items A line_item belongs to order In my OrdersController I have def summary @orders = Orders.find(:all) render :xml => @orders.to_xml() end What I want to achieve is to
2009 Apr 28
0
Writing an imgae tag in to_xml
Hi, I am trying to create an pdf report by using ruby jasper pages. For that I have written customer_list.rxml file like this: xml.instruct! xml.customer_list_result do xml.invoice_customers do @customers.each do |customer| xml << customer.to_xml(:dasherize=>false,:skip_instruct=>true,:only=>[:id,:name,:city],:root=>"customer") end end end I want to
2007 Feb 21
1
Rendering all the elements when calling Array#to_xml
When I call to_xml on an array, I want it to get the XML for all the elements in it. I''ve defined to_xml in my class. >> r.to_xml => "<video><id>1</id><views>2</views></video>" >> a = [r] => [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>] >> a.to_xml => "<?xml version=\"1.0\"
2007 Sep 30
1
to_xml node names with underscores
When I call to_xml on my active record objects, it replaces underscores with hypens. E.g.: <categories> <category> <content-provider-id type="integer">1</content-provider-id> <id type="integer">2</id> <name>Traffic Alerts</name> </category> </categories> When the actual field is content_provider_id. I remember
2007 Jun 11
2
Builder::XmlMarkup and dashes
Has anyone hacked Builder::XmlMarkup to dasherize underscore tags by default? I know I can use tag!, but I''d like to find a way for it to translate underscores to dashes automatically. In other words: xml.department_manager do "fred end #=> <department-manager>fred</department-manager> I tried hacking Builder::XmlBase.method_missing but got myself all twisted up!
2007 Feb 15
3
Restrict attributes in to_xml
For example, let''s say I have a User model with 2 attributes: 1. pw_hash 2. pw_salt I don''t want these to show up in the to_xml method. How do I keep to_xml from using these attributes? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2009 Jan 05
5
ROXML versus simple to_xml
How they differ? Does the to_xml method of the classes array/hash/object is based on ROXML lib? As I see in http://roxml.rubyforge.org/#quickstart, roxml needs we define the class (class Book in the guide) before to convert a object to xml. Moreover, the method to_xml (when not using "include ROXML") just accepts any existing object, what is much suitable. I need to compare and tranfer
2010 Feb 11
2
Inconsistent Hash#to_xml Method
I have a unit test that demonstrates some inconsistent behavior with a Hash being converted to XML with the :root option. Sometimes it works fine: Hash.new.to_xml(:root => ''test'') "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>\n</test>\n" But sometimes I get an argument error: Hash.new.to_xml(:root =>
2007 Jan 17
4
changing the default behaviour of to_xml for has-many: associations
I recently submitted a patch to work around an issue I was having & added a new optional behaviour to the to_xml method but on further reflection I wonder if the default behaviour should be changed. The gory detail, documentation and test case is all here... http://dev.rubyonrails.org/ticket/7004 Here''s a brief example... class Person < ActiveRecord::Base has_many: children
2006 Jul 14
1
creating a computed column with activerecord for to_xml
Hi. I have a question about activerecord, computed columns and to_xml. I have a simple model called person that has a first_name and a last_name field (and thus a first_name and last_name field in the Person table). When I :find a model and call to_xml, I would like the result to not only send back first name and last name as xml but also add an additional attribute called full_name that is
2010 Mar 08
1
to_xml repeating elements and plain strings
Say I want to output XML like this: <myXML> <id>123</id> <fruit>apple</fruit> <fruit>banana</fruit> <fruit>pear</fruit> <fruit>lemon</fruit> </myXML> Is there a way of doing that with to_xml? It seems like there''s two problems: to_xml always creates a wrapping element <fruits> when it encounters an