I have a Date class which I would like to use to overwrite Ruby's Date class. However, whenever I do a require 'Date' in my other files, it includes Ruby's Date class and not my own.
I thought that putting it in a module would work well, so I did so within the Date.rb file:
module myModule
class Date
#...
end
end
However I stil...
I'm trying to make an image of a graph using ruby-graphviz by
@graph.output(:output => "png", :file => "public/images/graph.png")
Since I'm using heroku, how can I save the image locally and send it to an s3 bucket, or just send it straight to the s3 bucket? I'd appreciate any help.
...
http://services.tvrage.com/tools/quickinfo.php?show=Chuck
I'm trying to parse that info, for exmaple, get the Airtime,
Airtime@Monday at 08:00 pm
I want to get what's after "Airtime@" till the end of the line, to just come out with "Monday at 08:00 pm". How can I do this?
...
Ok, so in my rails project. I'm getting this error, any help?
class SearchController < ApplicationController
require 'rubygems'
require 'open-uri'
def index
@show_info
end
def do_search
@show = params{:search_term}
@show = @show["search_term"]
@url = "http://services.tvrage.com/tools/quickinfo.php?show=#{@show}"
@si...
Can you great and knowledgable programmers please point me to some current and updated Ruby/Rails blogs/sites? I am also looking for an active forum for lively discussions on ruby/rails.
I already tried to google for them but as I already mentioned on SO, many of the links on google seem to be to sites that are no longer updated.
...
I just switched my Ruby version to 1.9.2, and the BigDecimal code works in Ruby 1.8 doesn't working anymore. Here is test code show what happened
irb(main):001:0> require 'bigdecimal'
=> true
irb(main):002:0> (BigDecimal.new("1")/BigDecimal.new("3")).to_s("F")
=> "0.33333333"
irb(main):003:0> (BigDecimal.new("1", 20)/BigDecimal.new("3",...
I've starting programming on ASP.NET MVC Framework a year ago.
Recently. I've learning Ruby On Rails Framework
There is "custom html helper" feature in ASP.NET MVC
So I can create my own html helper
<%= Html.MyOwnHtmlHelper() %>
I've learned that there is html helpers in Ruby such as
<% text_area %>
which render at html
I have a ...
Hi,
I started using vim for my programming projects (mostly Ruby) and mostly everything works just as I want but I have a problem with compiling.
Lets say I am working on a Ruby script and I want to run it. I type :ruby sometging.rb (mapped to some other key). Then vim opens a new cmd.exe window and runs 'ruby something.rb'. Then it w...
Hi.
Is it possible to set a Unicode string as a segment of a path in Rails?
I try the following:
# app/controllers/magazines_controller.rb
class MagazinesController < ApplicationController
def index
end
end
...
how do you create a dynamic tree menu helper using awesome nested set (or any other set plugin) in rails ? the result should look something like this:
<div class="level_0">
<span class="title">Categroy</span>
<div class="level_1>
<span class="title">SubCategroy</span>
<div class="level_2>
SubSubcategory
SubSubca...
In irb
data = "2 1058 657682"
barcode = Barby::QrCode.new(data)
File.open('barcode.png', 'w+')
{|f| f.write barcode.to_png(:height => 100, :margin => 25, :xdim => 100) }
Generates error:
ActionView::TemplateError (/Library/Ruby/Gems/1.8/gems/barby- 0.4.0/vendor/rqrcode/lib/rqrcode/qrcode/qr_code.rb:296:in `...
Which is better practice; manipulating properties with accessors by @property or self.property?
...
I need to call some helpers from a Markdown view. Is this somehow a good practice and is generally supported on popular ruby-based Markdown parsers?
...
Table is a Mongoid model that must dinamically map to different databases/tables
# app/models/table.rb
class Table
include Mongoid::Document
end
# in app/controllers/some_controller.rb
def index
Table.connection.database = :other_database # <- How to do this ???
Table.table_name = params[:id] # <- How to do this ???
@records...
When a user saves a form, I want to do the following check before saving
if header2 is null
header2 = header1
I don't want to add validation and stop the save action, because header2 is only needed in rare occasions.
I'm not sure how to have the update method in the controller do this. The command to commit the update is
if @entry.u...
I'm trying to setup a puppet node, but rubygems doesn't seem to behave.
If I run facter on the cli via it's own binary (/usr/lib/ruby/gems/1.8/gems/facter-1.5.8/bin/facter), it works fine, but if I run it through the binary installed by rubygems (/usr/bin/facter), it throws:
/usr/lib/ruby/1.8/facter/uptime.rb:11: undefined method `get_...
I really had a hard time figuring out how to word this question, but in essence, I want to do this:
model = MyModel.new
model.title = "foo bar"
model.title.to_id #=> "foo_bar"
I have an ActiveRecord class for MyModel
class MyModel < ActiveRecord::Base
def to_id(str)
str.downcase.gsub(" ", "_")
end
end
but, of course, it's l...
Im new to "real" Javascript:ing and I know understand more of functional programming.
It seems that in Javascript you get the best from both worlds: functional and object oriented programming.
But in Ruby, you don't have first class functions (function as a datatype).
Does this mean that Javascript embraces the best of the both worlds...
Hi, I'm looking for a library/component/class to create synamic cross-tab reports that must be shown on a web page.
One important requirement is that it must run on Linux and written in PHP, Python, FreePascal, Ruby, C or C++. I can't use Java or Mono here.
...
I'm using an ORM called Ohm in Ruby that works on top of Redis and am curious to find out how the data is actually stored. I was wondering if there is way to list all the keys/values in a Redis db.
Any lead will go a long way in helping me out (I'm basically stuck atm). Thanks in advance!
Update:
A note for others trying this out using...