Maybe i've just got a bad brain today, but i suddenly can't figure out how to read an email with ruby's net/imap library. I've been at it for several hours. I typed several variations of "ruby imap read body" into google and have explored many sites. All of them have examples on how to pull attachments, sync e-mail servers, work with gma...
Hi there,
I want to rewrite several methods of HighLine to customise my console and at the moment my code looks like this:
cmd = ask("#{@prompt_label} #{@prompt_separator} ", @tab_completion_candidates) do |q|
q.readline = true
# rewriting the Question class to make it do what we want
class ...
Hi there,
I was wondering if anyone had any advice on parsing a file with fixed length records in Ruby. The file has several sections, each section has a header, n data elements and a footer. For example (This is total nonsense - but has roughly similar content)
1923 000-230SomeHeader 0303030
209231-231992395 MoreData
2938...
As far as i know, the result of
["a", "A"].uniq
is
["a", "A"]
My question is:
How do I make ["a", "A"].uniq give me either ["a"] or ["A"]
...
Hello,
I'm looking for a rails plugin/gem which brings the functionality of marking an ActiveRecord-Model deleted, instead of deleteing it.
Does anybody know, what gems or plugins are up to date? (AAP is out-dated and is_paranoid doesn't appear to be used by the community).
Do you know alternatives?
...
I'm dealing with a SOAP webservice call from a server that is expecting to receive method calls with the paramaters in the format of:
<urn:offeringId> 354 </urn:offeringId>
But SOAP::RPC::Driver is generating messages in the form of:
<offeringId xsi:type = "xsd:int">354</offeringId>
The server keeps erroring when it gets these mess...
Hello,
does anyone know how to prevent the failing mechanism of link_to_unless_current?
f.e.: I have my page navigation with
link_to_unless_current "new task", new_task_path
When I click on the link, i come to the new taks path form... And no link is created -> ok.
Then I put incorrect values in the form and submit.
The TasksCont...
Hello,
I'm new to Ruby and recently ran into an issue comparing to values when creating a Ruby on Rails application. In a controller I had the following statement that always returned false:
if (user.id != params[:id])
The problem was the user.id (which is an Active Record) is an integer and params[:id] is a string. It took me a wh...
Similar Stack Overflow Question
I want users to be able to search through my thinking_sphinx text box a word like wood and have it pull up Wooden and Woodworking. This words fine if the user types in wood*, but if they type in just wood with no * then no results are shown. If there a way to get the results of wood* without having to ty...
Why isnt that working:
>> s = "hi"
=> "hi"
>> s == ("hi"|"ho")
NoMethodError: undefined method `|' for "hi":String
from (irb):2 ...
I want to encrypt a file that a ruby program will be loading data from.
In addition, I need the program to prompt for a password on startup that will be used to decrypt the file.
In other words, the file needs to reside encrypted on the machine and only users with passwords will be able to run the app.
I have started to look at openpgp...
I would like to create a migration to add test data to other developer's environments using the data that I have manually added to my own test environment over the past month or so. Is there a good plugin or gem to do this quickly? I started trying to create one manually yesterday and wanted to claw my eyes out after about 10 minutes, so...
Hi!
How do people generate auto_incrementing integers for a particular user in a typical saas application?
For example, the invoice numbers for all the invoices for a particular user should be auto_incrementing and start from 1. The rails id field can't be used in this case, as it's shared amongst all the users.
Off the top of my head...
I have a great number of methods like this:
def enableMotors
@posIface.Lock 1
@posIface.data.cmdEnableMotors = 1
@posIface.Unlock
end
def goTo (pos)
@posIface.Lock 1
@posIface.data.cmdVelocity.pos = pos
@posIface.Unlock
end
I would like to create functionality to :before_filter and :after_filter or any other way I can kee...
Our family has created a Flickr group in honor of a recently deceased relative. We are planning to show the group pool slideshow at her memorial service.
The flickr slideshow functionality is great, but it does not auto loop. Plus randomizing photos within a large group pool does not seem to be easy.
I'd like to just download all the g...
I think I'm approaching this the wrong way, which is why I can't seem to figure out an easy solution. I'm relatively new to Rails, so bear with me.
I have a layout, "store," that contains all of the common visual elements for the other controllers. In this layout, I need to dynamically create the sidebar with data from two models, Produ...
The following produces a working select drop down that pulls from my user model:
<%= f.collection_select(:user_id, @users, :id, :firstname, options ={:prompt => "Select a User"} %>
I also have a column :lastname.
I am trying to populate the select with something like :firstname + " " + :lastname
This obviously fails if I just stick ...
How do I parse CSV files with escaped newlines in Ruby? I don't see anything obvious in CSV or FasterCSV.
Here is some example input:
"foo", "bar"
"rah", "baz \
and stuff"
"green", "red"
In Python, I would do this:
csvFile = "foo.csv"
csv.register_dialect('blah', escapechar='\\')
csvReader = csv.reader(open(csvFile), "blah")
...
I've a Rails 2.3 site with versions both in spanish and english, I am using translated_model.
I am using acts_as_solr for full text search using multi_solr_search to return results from various models.
I need to the search feature available both in spanish and english, how can I restrict the search to certain fields depending on the I1...
Hello,
Please look at the two examples below:
irb(#<ActionView::Base:0x2863d58>):030:0> paintings_path
=> "/some-nice-alias-path"
irb(#<ActionView::Base:0x2863d58>):029:0> self.controller_name.to_s + "_path"
=> "paintings_path"
How do I return the path instead of the string? I need to call the controller path from my application he...