I have some existing projects that were built upon a deprecated PHP framework, and I'm hoping to move them over to Ruby on Rails with minimal effort. My main problem right now is the format that the JSON is coming back in. My frontend code (all ExtJS) is expecting JSON in the format:
{
"result": [
[id: 1, name: "mike"],
...
Hi all,
I have a table called Basic , start_time is one field with type :VARCHAR(5), which actually stores a 5 bytes time data: byte 0 and 1 map to the year , month and day, and byte 2 to 4 map to the hour, min and second. So, it could possible bytes 2 ,3 ,4 are all 0. And I want to do following query :
Basic.find (:all , :conditions =...
Hi.
I'm using the :overwrite_params option in link_to helper. But I have problems overwriting nested parameters values. Here some code:
With:
link_to book_item.editorial, :overwrite_params => {:filter => {[editorials.id] => book_item.editorial.id.to_s}}
The complete params[:filter] value is replaced (ie. I lost params[:filter][:auth...
I need to set up a payment solution within one of our Rails apps using the ActiveMerchant library. Although this question is highly subjective, what are people experiences with the major gateways out there (BrainTree, Authorize.net etc)?
It must:
handle recurring payments.
have the ability to credit a persons account.
have the ability...
Over the weekend, for some reason, one of our servers has decided to start throwing the following errors (nothing has changed). Any ideas?:
/!\ FAILSAFE /!\ 09:57:05 AM Mon, 29 Jun 2009
Status: 500 Internal Server Error
undefined method `fdiv' for 0:Fixnum
/usr/lib/ruby/1.8/yaml/rubytypes.rb:146:in `is_binary_data?'
/usr/l...
Hi,
I login to the Facebook site, how can I get the UID?
Uisng http://mechanize.rubyforge.org/mechanize/
...
Hi,
I want to remove all images from a HTML page (actually tinymce user input) which do not meet certain criteria (class = "int" or class = "ext") and I'm struggeling with the correct approach. That's what I'm doing so far:
hbody = Hpricot(input)
@internal_images = hbody.search("//img[@class='int']")
@external_images = hbody.search("//...
I have a model that uses a acts_as_nested_set fork, and I've added a method to the model to save the model and move the node into the set in one transaction. This method calls a validation method to make sure the move is valid, which returns true or false. If the validation fails, I want my save method to raise ActiveRecord::Rollback to ...
Question: Can I document Ruby code using Doxygen?
Disclaimer: I know ruby already has a system for documentation built in and there are probably other ways to do it as well, but the specific constraint I am operating under is how to get Doxygen to do the job (assuming it is possible).
Thanks in advance for any pointers.
...
I tried following the README file in Ruby 1.9.1 but I can't compile it using MinGW in Windows. Can you help me with this?
Thanks.
...
I have a page which uses the UTF-8 character set, however the characters are mangled on the page, I think this is just a matter of setting a header "Content-Type: text/html; charset=utf-8" ... I know how to do this in PHP, simply place the following at the top of the page.
<?php header("Content-Type: text/html; charset=utf-8"); ?>
Is ...
I need to convert some strings, and pull out the two first integers e.g:
unkowntext60moreunknowntext25something
To:
@width = 60
@height = 25
If I do string.to_i, I get the first integer:, 60. I can't figure out how I get the second integer, 25. Any ideas?
...
I need to use a rails app from C++. I say login in the title because that's one of my options.
As far as I see it, I either need to do the standard login, and keep track of a session or something in the C++ code, or use an API token of sorts, and just pass that on every URL and never actually create a session on the rails side (which us...
I found the HTML Agility Pack useful and easy to use for screen scraping web sites. What's the equivalent library for HTML screen scraping in Java, Ruby, Python?
...
I do not know ruby. I am trying to use the following regex that was generated by ruby (namely by http://www.a-k-r.org/abnf/ running on the grammar given rfc1738) in php. It is failing to match in php, but it is successfully matching in ruby. Does anyone see what differences between php's and ruby's handling of regexes that might expla...
Okay. So I have three models, a, b and c. a has_one c, b has_many cs, and c belongs_to both a and b. When I reference "cs" in a method of b, it comes out fine. But when I reference "c" in a method of a, it can't find the reference; it says "c" is an 'undefined local variable or method'. I know that c objects are getting created, because ...
It seems that print, put, or logger.info doesn't work in an included gem. I was wondering if there was a workaround. Thanks!
...
Hello,
This is a newbie question as I am attempting to learn Ruby by myself, so apologies if it sounds like a silly question!
I am reading through the examples of why's (poignant) guide to ruby and am in chapter 4. I typed the code_words Hash into a file called wordlist.rb
I opened another file and typed the first line as require 'wo...
Hey,
As a bit of a fun project I'm implementing a Beatnik interpreter in Ruby. If you've never heard of Beatnik it's an esoteric programming language in which operations are specified by the "scrabble score" of the words in the source code.
Anyway, the implementation requires a different operation to happen for different scrabble score...
I've been studying fibers in Ruby, and the term semicoroutine has come up. What is meant by a semicoroutine?
...