I tried Node.inner_html= to no avail, setting it to the string that
resulted if I interpolated the where I wanted it. Not sure why
it didn't work, but the replace/after works, so I went with that.
Thanks for the help.
Wes
--
Posted via http://www.ruby-forum.com/.
--
You received this mess
This works:
#Surround all of the text (NOT attribute value) merge fields with
tags for ease of manipulation later
doc = Nokogiri::HTML.parse(html)
nodes = doc.xpath("//text()[contains(.,'MERGE')]")
nodes.each do |node|
text = node.text.dup
if md = text.match(/.{2}MERGE(\d+).{2}/)
start_
This doesn't work - when I write this back out to a file the is
escaped.
Perhaps I should have mentioned that I needed to re-serialize the
resulting HTML.
Wes
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Ra
Thanks Walter, ended up with this:
doc = Nokogiri::HTML.parse(File.new(merge_path))
nodes = doc.xpath("//text()[contains(.,'MERGE')]")
nodes.each do |node|
text = node.text
if md = text.match(/.{2}MERGE(\d+).{2}/)
start_index = text.index(md[0])
start_span_tag = ""
end_index = star
All,
I'm using Nokogiri to handle the following problem:
I have a piece of HTML, and for certain text nodes, I need to insert
tags into the text of these nodes at a certain place.
What I am doing is finding the place where I want to insert the ,
let's say index X of the text node's text, and do
Ha ha - now it is an option! But only for the last two years so I don't
feel stupid for doing what I did.
>From the memcached man page on OS X:
" -I
Override the default size of each slab page. Default is
1mb. Default is 1m, minimum is 1k, max is 128m. Adjusting this value
c
Answer:
I18n.translate('number.currency.format.unit', :locale => '')
W
--
Posted via http://www.ruby-forum.com/.
--
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-t...@googlegroups.com.
T
How do I interrogate a given locale for it's currency unit?
Obviously, I can parse my own Yaml translation files, but I'm assuming
that there is a simpler way to do it via a direct call to I18n, perhaps?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--
You received this message becaus
Is there any way to suppress the generation of the authenticity_token
div by passing an option to form for?
I'm generating a form that I will allow others to use outside of the
current session.
I've already put in the appropriate skip_before_filter
:verify_authenticity_token in the controller for
PI, but am willing to do SOAP if I
must.
Any feedback would be of interest.
Many thanks,
Wes Gamble
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send em
All,
I need to be able to integrate with Google checkout. Does anyone have
advice for which gem/plugin would be most appropriate to use to
integrate with it?
Many thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
I'm working on an app. with the userstamp plugin in it (from 2 - 3 years
back).
In the init.rb file, there's this:
ActiveRecord::Base.send(:include, ActiveRecord::Userstamp) unless
RAILS_ENV == 'test'
This causes certain tests to fail since created_by is a required
attribute.
Does anyone know
Is there any place that I can get versions of the SQL Server adapter for
Rails that are <= 2.1.0?
I've looked at http://github.com/rails-sqlserver and the oldest version
there appears to be 2.2.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~
I'm using Rails 2.1.2 at the moment.
So I need to reliably call a private method dynamically, and I don't
want to have to change how I do it when I move to Rails 2.3.2 nor Ruby
1.9.
Should I use Object#send or something else?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-
All,
It appears that Rails adds the send! method to Object, via the output
below.
gandalf-2:royaltyzone weyus$ irb
>> Object.methods.include?("send!")
=> false
>> exit
gandalf-2:royaltyzone weyus$ script/console
Loading development environment (Rails 2.1.2)
>> Object.methods.include?("send!")
=>
All,
I understand that there are a few plugins/gems which are available that
allow relatively straightforward integration with various SMS gateway
providers.
I'm looking for recommendations from people on preferred SMS gateway
APIs - why do you like them?
Also curious about any scalability issu
Roy Pardee wrote:
> Never tried it. I think the lack of an adapter is what kills this. I'd
> be curious to hear whether the sqlserver adapter in ODBC mode could be
> fooled into hitting msaccess w/the right connect string...
Good point. Might be that the connect string setup would have to be
Curious as to whether anyone out there has set up Rails as a front end
to a M$ Access DB?
I have done it with SQL Server, and have used ODBC to do it, so I know
that this is certainly possible.
I'm interested in gotchas, and good advice.
I'm not interested in hearing questions about why someone
I am humoring a client, but I am advising strongly against it.
The desired behavior is the ability to edit a document after it is
generated via a Web form. I am pushing for making the Web form
flexible enough to handle generating whatever they want into a read-only
PDF.
But I feel like I ne
All,
Anyone done any work generating Word documents/Word templates from a
Rails app.?
I'm sure that there is a way to do this without too much trouble in a
JRuby world, so wondering about that approach as well.
Any advice is welcome.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~-
SOLUTION:
I forced my custom version to be loaded by using a more explicit
'require' statement and this overrode the built-in memcache client.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscrib
Since Rails 2.1, the memcache-client gem has been bundled with
ActiveSupport.
I have an app. which has a customized version of the memcache-client
code, and I would like to disable the built-in memached-client.
How can I go about doing that?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/
Anyone ever done HTML validation of an arbitrary piece of HTML within
their RoR app.? Any gems/plugins that would work? Would Hpricot do the
trick?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you
er, Rails based :).
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
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@googlegroups.com
To u
area. I'm
not looking for anything fancy, just something that would give me a head
start and is worth using (meaning I get more value from taking advantage
of it than customizing it).
Thanks,
Wes Gamble
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~-
All,
Rails 2.1.0
AR SQL Server Adapter 2.2.19
I use the AR session store in my application. When I upgraded to the
latest version of the SQL Server Adapter, my app. stopped working
because supposedly my session data wouldn't fit into the "data" TEXT
column in my sessions table.
This block of c
Duh.
RAILS_ENV=production lib/import_physicians.rb
works fine.
W
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send
That's correct, but I can't get it to work when the script/runner
command is _in a file_, like so:
import_physicians.rb:
#!/usr/bin/env ./script/runner -e production
If I run import_physicians.rb, this doesn't work.
W
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~--
All,
I have a script that runs script/runner via the shebang mechanism at the
top o the file, like so:
#!/usr/bin/env ./script/runner
This works fine in development, how would I get it to run in
non-development environments?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~---
If I do this, it works:
page.replace_html('search_results', render(:partial =>
'search_results'))
Notice that originally, I was passing just the hash key/value pair, but
now I am passing a render call.
According to the API docs:
"options_for_render may be either a string of HTML to insert, o
Bradly Feeley wrote:
> I think I remember an issue that when using custom formats you need to
> give the full path the the partial like :partial => 'posts/
> search_results'.
>
> Bradly Feeley
>
>
> On Apr 18, 6:01�pm, Wes Gamble
That doesn't s
I have a custom format that I'm using called 'desktop'.
I have an action which is called via AJAX, and I'd like to update a div
in my page with a partial.
The request comes in with params[:format] == 'desktop', and my partial
is named _search_results.desktop.erb
However, when I do this in my ac
>>
> check the top of your app's test_helper.rb.
>
> Fred
Nicely done, sir. Many thanks.
W
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
I am certain that running:
rake test RAILS_ENV=
should work, assuming that I have a correct DB setup in
config/database.yml.
But this is not happening. It looks like rake test always is using the
"test" DB no matter what.
If I type
rake test RAILS_ENV=crap
or
RAILS_ENV=crap; rake test
my
I'm trying to port an existing, home grown authentication system to use
RESTful Authentication (and then RoleRequirement on top of that).
I am concerned about how best to handle the existing user data in my
users table so that legacy (pre-RESTful Auth users) can log in.
I already have an existin
Fred,
I already have a custom version of error_messages_for, so yeah, that's
cool.
Thx. for the quick response.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
Is there any way to control the ordering of the error messages in the
output of error_messages_for()?
I want to make the error messages match the order of the form elements
in my form, and although the validates_presence_of directive has these
attributes in that order, they still show up in seemi
Rob,
Sadly, my impression is that the state of this world has not much
improved since I wrote this post so long ago.
I am resigned to doing upgrades on my Rails apps. more or less one point
release at a time since there doesn't appear to be any more reliable way
to get deprecation information
Fred,
Thanks for the info. I neglected to mention that this is on Rails 1.2.6
(please no one "helpfully suggest" that I upgrade - thanks ;]), so these
options are not available. It's fine - I won't die.
One further question, if you use a "unified" helper like date_select in
the current v. o
Rick,
Thanks, but not what I'm looking for.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
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 rubyonrai
All,
Is there any built-in way in the "select" form helper to display
something other than "Select" in the :include_blank option?
Specifically, for a date helper, would like to show "Month", "Day",
"Year" respectively for those options in 3 selects.
Thanks,
Wes
--
Posted via http://www.ruby-for
Jeff Cohen wrote:
>
> What version of RubyGems are you using to do the install? If it's
> before 1.2.1 (I think), you need to add the --include-dependencies
> switch to the gem install command.
>
> Jeff
> switchingtorails.com
1.3.1
That's kind of why I'm asking. I know that 1.3.1 is supposed
I recently had a need to install the Rails 1.2.6 gem (for support
reasons). When I did it, the dependencies were not installed
automatically, so I had to find and get the correct versions of
actinomailer, actionpack, etc.
Anybody seen this behavior before and have any insight into that?
Wes
--
The has_many part of the Invoice class is actually provided by a plugin.
And inside of that plugin, a set_table_name was being done to point to
the offensive table.
I got this to work by making the inclusion of that plugin dependent on
the setting of RAILS_ENV. Which isn't pretty, but works.
Frederick Cheung wrote:
> On 16 Jan 2009, at 20:44, Wes Gamble wrote:
>
>> When the Invoice class is loaded, all of its class level association
>> directives are executed. When it hits the one that doesn't have a
>> backing table, it fails.
>
> So it'
When I call Invoice.find_all_by_im_invoice_state("Paid").each the
Invoice class is loaded.
When the Invoice class is loaded, all of its class level association
directives are executed. When it hits the one that doesn't have a
backing table, it fails.
So I need to be able to modify the Invoic
Here's my real problem:
I am trying to load a fixture into a database which acts as a secondary
DB to my application.
The fixture file uses Erb to generate appropriate fixtures based on
something like this:
<% Invoice.find_all_by_im_invoice_state("Paid").each do |inv| %>
...generate a bunch
How can I remove an association from an AR model with a monkey patch?
Assume:
class Foo < AR::Base
has_many :bars
end
It's a long story, but in one particular data loading (not running the
app. context), I'd like to remove the has_many association to :bars.
Can I do that?
Thanks,
Wes
--
Po
Supraja wrote:
> Dear Wes,
>
> I saw that you had posted on "mysql" 2.7.3 gem install for Windows
> issue. I noticed you said you probably wouldn't pursue it, but I was
> wondering if you had any success since then?
>
No, still haven't resolved it. Hoping that the next release of the
mysql ge
I remember now why I was trying to get this to work.
Because the built-in support for MySQL has been pulled out of Rails 2.2,
I was just trying to anticipate any 2.2 projects that I needed to
run/handle on Windows.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~--
>a reinstall or major upgrade of OSX will trash /usr/local.
Good tip!
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this
My main OS is Mac OS X.
Actually, getting the MySQL gem to install on Mac OS X was no mean fit
given the 32/64 bit issues with the version of Ruby that ships with OS
X. But I did get that working the other day.
I'm comfortable compiling stuff on OS X.
This exercise was to set up my Windows X
All,
(sorry, I mis-titled this post as "Best way to add custom onclick
handler to select options" and posted it before I could fix the title).
I want to make an individual in a act as an in-place
edit field.
I get how the in_place_editor works, and it appears if I simply place a
tag "around"
All,
I want to make an individual in a act as an in-place
edit field.
I get how the in_place_editor works, and it appears if I simply place a
tag "around" the of interest, and then mark this tag as the
edit-in-place target, I should be good.
The trick is how do I easily decorate the tag wit
Rick wrote:
I'm under the assumption that the mysql gem for Windows is precompiled,
like all of the other gems for Windows (generally speaking), so there
isn't really a compilation step.
Here's the output from the --verbose run. I notice that it can't find
the
H:\>gem install mysql --verbos
Rick wrote:
>
> ruby ./test.rb -- localhost test test testDB
>
I get this when I run test.rb:
C:\ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext>ruby test.rb
-- local
host test test testDB
Loaded suite test
Started
.FE..C:/ruby/lib/ruby/1.8/test/unit/assertions.rb:497: [BUG]
Segmenta
Upon further inspection, I see that AR doesn't depend on DBI. I wonder
why not...
As it turns out, I'm in a JRuby environment, so I can just do prepared
statements via that method.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
Yo
I have a standalone batch program that is going to move data between two
databases.
I am taking advantage of the AR connection semantics in database.yml to
get connections to these two DBs. But I want to do all of my DB access
at the DBI/DBD level for performance reasons.
I am having trouble ge
Rick wrote:
> Hi Wes,
>
> Did you see anything in the ext directory?
>
> Rick
>
>
> On Nov 25, 10:30�am, Wes Gamble <[EMAIL PROTECTED]>
Yes. I see the following files:
extconf.rb
mysql.c.in
mysql.c.in.patch
mysql.so
test.rb
Wes
--
Posted
When I install the 2.7.3 "mysql" gem on Windows XP (trying to prepare
for the requirement to use the mysql gem in Rails 2.2.2) by using:
gem install mysql
I get a mysql-2.7.3-x86-mswin32 directory under gems, but underneath
that, only a docs directory, an ext directory, and README, Rakefile and
I have some models in my app. that connect to a different database than
the rest of my app.
How do I set things up so that when I run my tests, I can associate the
appropriate fixtures with the appropriate database. For example, I'll
want most of the fixtures to get loaded into the "test" databa
Is there a way to query the DB connection behind an AR::Base object for
the date string format expected by the DB?
I'm trying to use quoted_date, however, this returns a formatted
timestamp and the column in question is simply a date.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--
Some answers...
In my particular case, I may not even need to worry about the has_many
relationship from A to B. If all I need to take advantage of is the
fact that B belongs_to A, _and_ I'm sure that my keys are all
consistent, then simply doing
belongs_to :a, :foreign_key => 'appropriate
All,
I'm looking at possibly having to define a has_many relationship across
two databases (possibly even two databases on different servers). To be
clear, I mean model A lives in database X and it's related to model B
that lives in database Y. A has_many B's.
It appears that if I want to do t
Enrico Thierbach wrote:
> Besides, I found a hack that would decrease the runtime overhead of
> using Symbol#to_proc, which is to cache the Proc object inside the
> symbol:
>
> class Symbol
> def to_proc
> @to_proc ||= Proc.new { |*args| args.shift.__send__(self, *args) }
> end
> end
>
All,
Have a friend who is starting out on Windows with Rails using Instant
Rails but he's having problems. Anybody have any good/bad experience
with it so I can help set his expectations?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~---
Hijacking the click handler by adding this:
:onclick => 'this.form.submit(); return false'
to the submit_tag() call for the submit button seems to work well.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message becaus
All,
I have a form that is using observe_form to periodically check for
modifications to the form and submit an AJAX request. It works really
well.
However, by watching Firebug output, I notice that the AJAX request
always fires when I click the submit button, and even when nothing has
changed
All,
I have a controller action/view pair that successfully generates a PDF
using Prawnto.
I like the idea of the view specifying the details of the PDF generation
in a view file (x.pdf.prawn).
However, I would like to be able to generate a PDF and instead of
rendering it to a view, just genera
All,
I'm working on an ActiveScaffold based application, and in the interest
of getting more functional test coverage, I'd like to verify things
about AS-generated screens in the context of multiple controllers.
In order to share these tests, I've created methods in test_helper.rb,
and simply in
I saw that you can just manipulate the session data to handle this, and
that is simpler.
But of course, I'm stubborn and I preferred the idea of actually "doing"
the login as part of the functional test.
I have worked around it, and here's the code that does it:
def login(user = 'blah', passw
Frederick Cheung wrote:
> On 3 Oct 2008, at 16:29, Wes Gamble wrote:
>
>> 3) Why is the Location header on the response showing to be what it
>> would be right after a login?
>>
>
> Does your login method actually do a request? that would explain
> everything. @
I'm seeing some header output from various HTTP requests and responses
that doesn't make sense to me.
I have a couple of functional tests that appear to work ok. In the
course of writing them, I went ahead and created a couple of methods to
dump the request and response headers to help me debug
I also found this approach which is interesting because it actually
forces a test of the login process each time.
http://alexbrie.net/1526/functional-tests-with-login-in-rails/
Thanks for the responses.
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~-
When writing functional (e.g. controller unit) tests, I'm running into a
simple problem that I'm sure is very easy to fix, but I'm not sure of
the correct approach.
If I request a resource in my test case, via something like "get
:get_template" (where :get_template is an action on my controller),
I have a plugin that I'm trying to use but it keeps looking in another
plugin's path for the view files.
I get this error:
"ActionView::MissingTemplate (Missing template blah.rhtml in view path
other_plugin_view_dir:my_app/app/views)"
I don't know much about setting up view paths in plugins, bu
Yeah, I just verified that.
Sorry, I should have tested it first.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send
Thanks, Frederick.
Follow - up: Is there anything that precludes using protect_from_forgery
with a DB session store?
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "R
Just would like to verify:
Is protect_from_forgery (in Rails 2.1) == the csrf_killer plugin from
Rick Olson?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ru
79 matches
Mail list logo