ruby -v = 1.9.1p378; rails -v = 2.3.8
wkhtmltopdf works just fine from the command line - generates a PDF. The path to the .exe is in the %PATH% variable as well as specified properly in the /config/initializers/wicked_pdf.rb file.
Set up the controller action to handler .pdf format but I get the following error
Permission denied - c...
I had a file I needed to edit in my .gitignore file.
I edited .gitignore, committed it, and still my file was unavailable to commit.
I deleted the file, readded it, and once it has the same name, its still unavailable to commit.
I tried -f, which then added an empty version of the file to my repository. And the worst apart about that ...
Disclaimer: My Sharepoint knowledge is slim, and my Ruby knowledge is novice-moderate.
I need to be able to programmatically upload files to a Sharepoint server. So far, I've been looking into the Savon gem (patched to add NTLM auth) to accomplish this.
Sample code so far:
require 'rubygems'
require 'savon'
WSDL_URL = 'http://<s...
How can you find the most recently modified folder (NOT A FILE) in a directory using Ruby?
...
I have been thinking about my shift from Java to Ruby and the thing that strikes me most is Ruby's lucidity ( I know the word lucidity is a qualitative abstract, I guess people who are riding on the same boat will comprehend). Sometimes, I feel I am almost writing psuedo-code.
Does Ruby take the paranoia out of programming and make it ...
I want to show a post author's name; <% @post.author.name %> works unless author is nil. So I either use unless @post.author.nil? or add a author_name method that checks for nil as in <% @post.author_name %>. The latter I try to avoid.
The problem is that I may need to add/remove words depending on whether there is a value or not. For i...
Does ruby have the Java equivalent of synchronize keyword? I am using 1.9.1 and I don't quite see an elegant way to do this.
...
I have this trial timer code to time euler solutions in Ruby.
$RUNS = 12
def run(solve)
times = []
$RUNS.times do
start_t = Time.now.usec
solve.call
end_t = Time.now.usec
times << (end_t - start_t)/1000.0
end
#times = times.delete_if {|i| i < 0}
puts times.inspect
times.sort
mean = times.inject{|a,c| a+c} ...
Hi,
I'm having trouble deleting from active record store.
I want to delete based on the session data:
ActiveRecord::SessionStore::Session.find(:all).each do |s|
if s.data[:userid] == 1234
s.destroy
end
end
does not seem to work, but:
ActiveRecord::SessionStore::Session.delete_all(["updated_at < ?", 12.hours.ago])
seems to...
Hey guys another rails issue,
Currently have a collection that is line items for an invoicing system. I want to increment the count of the line items if I add in an item that already exists. At the moment I'm using an exists? query on the collection but it seems to return regardless of the key.
The foreign key I'm using is item_id, so ...
i have searched around, but can't find any built-in way to do convert an object (of my own creation) to a hash of values, so must needs look elsewhere.
my thought was to use .instance_variables, strip the '@' from the front of each variable, and then use the attr_accessor for each to create the hash.
what do you guys think? is that th...
Im trying to create a board game generator in ruby which takes images from one pdf and places them them on the tiles of the board-game template pdf. One image per tile.
I'm wondering what tools would be good for this in ruby. Ive looked at prawn and that seems great for creating the board game but i don't think i can use that for extra...
I want to learn Ruby on Rails. It's my first web language. I understand that Ruby is a language, and Ruby On Rails is a framework. The thing I'm not clear about is whether I need to learn Ruby in depth first, and then learn Rails afterwords. Is that right?
Or is it better to learn them simultaneously?
And, while you're at it, what's t...
One syntax I am not able to understand is like this:
test = heavy::Test.new_test()
test.setq(name)
Here test is an object and in some other file there is module heavy and inside heavy there is another module Test but after that what is this new_test()?
...
Good morning :),
I like to localize the "previous" and "next" links in will_paginate, how can I do that?
Did anyone find a nice workaround?
Thanks in advance
cheers tabaluga
...
Hi evryone,
I'm trying to replace all my tags in an HTML file by <%= image_tag() %> rails tag.
What i want to do is something like :
doc = open("myfile.html") { |f| Hpricot(f) }
imgs = doc.search("//img") # here i got all Hpricot::Elements
imgs.each { |i|
# fake function name !
i.replace_by_HTML('<%= image_tag("/images/blab...
I have a simple Ruby program which takes the command line arguments and posts them to a server.
However, I want to be able to write the # (pound, hash symbol) in my arguments without ruby trying to parse it. I'm not so familiar with Ruby. I know I can pass the arg with quotes, but I would like to know if it's possible without them.
ARG...
Hello again great knowledge masters of stackoverflow,
once again the small coder apprentice tabaluga is in need of help
The Goal : make the username sortable in the view. The difficulty is, that I am Querying Profiles in the controller ( Profile.username doesn't exist but Profile.user.username does). How Do I accomplish that? My Code so...
I've a regular expression that should validate if a string is composed by space-delimited strings. The regular expression works well (ok it allows a empty space in the end ... but that's not he problem) but takes too long when the validation fails.
The regular expression is the following:
/^(([\w\-]+)( )?){0,}$/
When trying to valida...
Hi
I have a document with an embedded document in it.
I have 2 forms, 1 that updates fields in document and one that updates fields in emdedded docs.
They are split into 2 forms as lots of fields in each etc and actually this is just a simple example of the structure of my app.
Everywhere else that i reference this data it makes m...