Displaying 20 results from an estimated 10000 matches similar to: "RoR programming style guide?"
2005 May 01
5
Example using Builder::XmlMarkup and .rxml files?
Greetings,
I''m a newby to both "R"s in RoR. I would like to use Builder::XmlMarkup
to generate my pages. If there is a working downloadable example
somewhere, that would probably be enough. Otherwise, here''s what
I want to do:
With the following controller:
class AccountsController < ApplicationController
layout ''accounts''
model :account
2007 Feb 04
10
where to install script.aculo.us ?
I''d like to try autocompletion, and my understanding based on AWDWR:2,
and on various website tutorials, is that I should install the
script.aculos.us
javascript library.
My question is how to do that. The instructions on their site tell me
to "Put prototype.js, scriptaculous.js, builder.js, effects.js,
dragdrop.js, slider.js and controls.js in a directory of your website,
2007 Dec 03
3
strsplit on comma, with a trailing comma in input
I have a comma-separated data file in which trailing commas sometimes occur.
I am using strsplit to extract the data from this file, and it seems great
except in cases with trailing comma characters.
The example below illustrates. What I'd like is to get a fourth element in
the answer, being an empty string just like the second element. Is there a
way I can express my patter (or perhaps
2006 Apr 06
8
Fastest learning path to RoR
hi!
with a 4GL background, wanting to learn RoR, what is the fastest
learning path i should take? should i go grab a RoR tutorial, and learn
Ruby along the way, or start with plain Ruby first?
thanks for any inputs!
2006 Apr 27
3
XML output
Hi,
Sorry abt the half finished post that I sent out earlier.
The idea is to generate an output xml response as such:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<response status=''NOT_AVAILABLE''>
<message>Some text</message>
<from>Me</from>
</response>
I make a request like such
2007 Nov 21
4
Builder::XmlMarkup adds <inspect/> on printing and <clone/> on saving
Hello,
I am new in this group. Please give me a short hint, in case this is
the wrong place for my posting.
I want to create an XML file and store it in "filetransfer". The XML
part of the file (the body) sould go to "filetransfer.data". Despite
the last line, everything is fine with the code below.
With "filetransfer.save" two entries "<clone/>"
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!
2006 Aug 13
4
Experienced RoR Coders Needed!
Devlounge is looking for advanced RoR coders who may be willing to share
their knowledge by writting quality articles on Ruby and what it can
accomplish. These can be tutorials, discussions, opinion pieces, getting
started guides, etc. You''re articles will be seen by 350-500 unique
people daily! Plus, you''ll get a great link back in our killer authors
index.
To apply to be
2006 Jul 14
2
how to get builder 2.0 to escape attributes in rxml
I am using rxml to produce opml files and need to escape ampersands in
the attributes.
builder 2.0 docs found at http://builder.rubyforge.org/ show the
following
xml = Builder::XmlMarkup.new
xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There")
xml.target! =>
<sample escaped="This&That"
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
2008 Jan 10
2
how to calculate time offset between timezones?
#QUESTION#
Is there a way to calculate the offset between timezones, e.g. from "AST" to
"GMT"?
#DETAILS#
I am working with data files that use local time, and that indicate the
timezone by e.g. "AST" (Atlantic Standard Time, my local time) in a header.
I was guessing that
> ISOdatetime(2008,1,1,1,0,0,tz="GMT") -
>
2006 Mar 03
4
Must one be a web page designer to make use of RoR?
Hey guys,
I''m new to the world of web site development. Although I''m in the
process of learning RoR, I''m not a graphics artist nor a web developer
or web site designer. With that being said, does anyone have any
suggestions for tools to use to create the actual interface for a web
app based on a RoR framework? Obviously the default output of RoR is
fine for
2006 Jul 03
2
XML Builder - xml header...
for some reason, i am getting an extra:
<?xml version = "1.0"?>
in my xml file..
i am using a file called:
lastLogins.rxml
and the code looks like:
xml = Builder::XmlMarkup.new
xml.instruct! :xml, :version=>"1.0", :encoding => ''ISO-8859-1''
xml.loginData do
@lastLogins.each do |login|
xml.entry do
xml.user(login.user)
2006 Jul 12
5
DRY version of RoR book PAYMENT_TYPES example
In the book there is an example how to convert DB payment value to more
readable from. PAYMENT_TYPES array is defined and then in your views you
can use it as Order::PAYMENT_TYPES.
The problem is: how should I convert DB values (for example with type
char(1)) to full string representation. I know that I can add a Hash to
a model: IM = {''S'' => ''Skype'',
2006 Aug 16
44
Goodbye for now, RoR
I started a php-based website a few months ago with a buddy of mine on
netfirms.com. I was perusing their knowledge base and I came upon a
quick-start for something called Ruby on Rails. Since then I have immersed
myself in RoR. I''ve done the tutorials, I''ve purchased the books.
But, I could never get even a sample RoR app to work on netfirms. 500
server errors.
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,
2007 Oct 10
1
rxml cdata problem!!!!!
source)
xml.list {xml.cdata! "test"}
result)
<list>
<![CDATA[test]]>
</list>
but I want to
<list><![CDATA[test]]></list>
(because firefox don''t understand first result)
how to?????
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Mar 26
2
Issue generating XML with hyphenated element names
Hello...
I''m trying to generate and XML file using .rxml and I''m having a
problem with element names that contain a hyphen. Here is a chunk of
the .rxml file:
xml.instruct! :xml, :version=>"1.0"
xml.properties do
@properties.each do |p|
xml.property do
xml.location do
xml.street-address(p.street_address)
xml.city-name(p.city)
..
end
end
end
2006 Jan 30
5
a RJS problem/patch
Hi,
add_rjs_to_action_view.rb of javascript_generator_templates
doesn''t work with setting Content-Type in a controller.
(e.g.) http://wiki.rubyonrails.org/rails/pages/HowtoSetDefaultEncoding
class ApplicationController < ActionController::Base
before_filter :set_charset
def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end
I
2008 Jan 28
3
A style question
I''m working on the ability to share a single session between Facebook
and Non-Facebook requests. Right now, to setup a shared session, you
create a link like:
<%= link_to "Non-Facebook
view",leaders_url(facebook_session_parameters.merge(:canvas=>false))%>
The facebook_session_parameters includes all of the necessary info. Is
this okay, or would it be better as