What can i do you find a case insensitive search
>> Band.find_by_name("metallica")
=> nil
>> Band.find_by_name("Metallica")
=> #<Band id: 3, name: "Metallica", created_at: "2010-10-03 01:17:24", updated_at: "2010-10-03 01:17:24", user_id: "4">
I need to find the record in both cases...any suggestions?
...
I have always written websites that interact with the endusers directly.
Now I want to create a website that lets users create their own websites - from scratch.
Almost like Drupal online, I provide all the unit blocks for them to use to build their own website. They just drag and drop text fields, buttons, (div) containers etc.
I hav...
Hey guys! do you know good books for Ruby On Rails With Facebook Platform. please suggest some good books for Ruby On Rails With Facebook Platform!
...
Has anyone have any success installing ImageScience on Ruby 1.9 for Windows?
Unfortunately, I am currently using Ruby 1.8 Windows for my development. I want to upgrade to Ruby 1.9 for the performance improvement. I was able to install almost all of the gems, but I haven't had any luck with ImageScience.
Rob Anderton had put in useful i...
Hi all,
new to rails and trying to get youtube-g to work... I am having a difficult time passing a users search from the form_tag to the controller.. for example:
user lands on page, enters - tiger videos - in text_field_tag
controller takes - tiger videos - and searches
user lands on another page displaying the results...
user lands ...
I am using Ruby 1.8.6, Watir 1.6.6, and RSpec 1.3.0. When I run the following script, it "terminates" (term given in EclipsePDT IDE) but no error is listed. Same when I run it from the c-prompt on windows, except no "terminate". The browser never opens. Anybody got a clue? It runs OK if I take off the describe, it, and end lines.
descri...
Is there any library that allows to handle Skype messages using Ruby?
...
Is there any library that allows to handle google talk messages using Ruby?
...
Hi there,
We got a Rails 3 Server based on Ruby 1.9.2 running on a MYSQL DB and Problems with the time.now and time.zone.now setting.
For better explaination we assuse its 13:00 UTC right now.
Ubuntu Systemtime is set to 15:00 UTC +02:00 (Thats CEST (Central European Summertime) and is correct for our Timezone).
The Rails time (time....
Basically what I want to do is to log an action on MyModel in the table of MyModelLog. Here's some pseudo code:
class MyModel < ActiveRecord::Base
validate :something
def something
# test
errors.add(:data, "bug!!")
end
end
I also have a model looking like this:
class MyModelLog < ActiveRecord::Base
def self.log_so...
I recently investigate a integration between ruby and R on Windows 7. So far, rinruby hangs (on my Windows7 machine) when I run a script. Now I learn from this post that rsruby does not work on Windows at all. Does anybody know a library that would work?
...
Rails 2.2.2
_competition.html.erb
<p>This is packed</p>
<% pack do %>
// some javascript
<% end %>
competitions_helper.rb
def pack(&block)
yield + 'PACKED'
end
However 'PACKED' does not get appended to my javascript string, its as if pack do has no effect. It seems like there is some oddness going off with context of the blocks ...
I want to split data to chunks of let's say 8154 byte:
data = Zlib::Deflate.deflate(some_very_long_string)
What would be the best way to do that?
I tried to use this:
chunks = data.scan /.{1,8154}/
...but data was lost! data had a size of 11682, but when looping through every chunk and summing up the size I ended up with a total s...
How does Ruby's nil manifest in code? For example, in Python you might use None for a default argument when it refers to another argument, but in Ruby you can refer to other arguments in the arg list (see this question). In JS, undefined pops up even more because you can't specify default arguments at all. Can you give an example of how ...
In the python world, there are a number of alternative python interpreters that add cool additional features. One particularly useful example is bpython, which adds dynamic syntax highlighting, automatically pulls documentation, and displays live autocomplete information. In the Ruby world, I have yet to uncover any projects which add to...
I have a ruby array
> list = Request.find_all_by_artist("Metallica").map(&:song)
=> ["Nothing else Matters", "Enter sandman", "Enter Sandman", "Master of Puppets", "Master of Puppets", "Master of Puppets"]
and i want a list with the count like this
Nothing Else Matters => 1
Enter sandman => 2
Master of Puppets => 3
So ideally i wan...
I am using Ruby's net-ssh library to remotely execute shell commands. I would like to read a few files into memory rather than simply transfer them via SCP/SFTP. Can can I do this?
...
I'm a newbie to programming & ruby (as well as datamapper & sqlite). I'm trying to figure out how to use all three but can't find any tutorials for beginners.
Please let me know of tutorials or books.
Thanks.
...
I've got a functional test that errors on the following method, saying that the first "Quality.create!(..." statement has too many arguments, which doesn't make any sense to me at all.
Running Ruby 1.8, Rails 2.3.5
def reset_quality_lut
Quality.delete_all
Quality.create!(:value => 1, :name => "Scrap", :extended_na...
I'd like to use Nokogiri to insert nodes into an XML document. Nokogiri uses the Nokogiri::XML::Builder class to insert or create new XML.
If I create XML using the new method, I'm able to create nice, formatted XML:
builder = Nokogiri::XML::Builder.new do |xml|
xml.product {
xml.test "hi"
}
end
puts builder
outputs the foll...