I have one page website only using HTML, CSS and JavaScript. I want to deploy the app to Heroku, but I cannot find a way to do it. I am now trying to make the app working with Sinatra.
.
|-- application.css
|-- application.js
|-- index.html
|-- jquery.js
`-- myapp.rb
And the following is the content of myapp.rb.
require 'rubygems'
re...
ruby -n is the closest thing I found, but it repeats the whole script. Also it's not available for irb.
...
I just installed TeamBox on my Ubuntu 9.10 server. I have it up and running on port 3000 using the provided server script.
It's running extremely slow, up to 30 seconds per HTTP request when connecting from another computer.
I used links to load up TeamBox from the shell and it took no time at all.
I then setup an SSH tunnel and agai...
I have both Rails 2.3.4 and Rails 3.0.0.beta installed on my local machine. I am using ActiveRecord in a stand alone ruby script and when I do require 'active_record' 3.0.0.beta is loaded. How can I force it to require 2.3.4 instead? (without uninstalling 3.0.0.beta)
...
I would like to put a large variable definition in a separate file for the sake of getting it out of the way. I must be doing something wrong though, because my puts call isn't putting anything out.
my_class.rb:
class foobar
def initialize
require 'datafile.rb'
puts @fat_data
end
end
datafile.rb:
@fat_data = [1,2,3,4,5,6...
Hello,
I have some difficulties for using Ruby block, passing in a method.
As in the following case, I would like to display each element of @array, from Box instance (using .each method):
class Box
def initialize
@array = [:foo, :bar]
end
def each(&block)
# well, hm..
end
end
a = Box.new
a.each { |element| puts eleme...
I've got a named route called profile and I would like to be able to access it as json. But when I look at my rake routes output I see that the (.:format) is missing. How do I add it to a named route?
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
profile /:username {:action=>"show", :contro...
Of course there are a thousand ways to get this done, but is the simplest (or most elegant) way to achieve this?
[4,8].max
That's actually not too shabby, but what would you do?
...
Hi,
In the past I used railsbrain.com to have a nice and handy offline api documentation.
But they stop at version 2.3.2
Is there any other solution with latest version.
Thanks
...
Hi,
I use the rails 3.0.0.beta
Is there any new syntax to write RJS, here is an example
def remote_create
@photo = Photo.new(params[:photo])
respond_to do |format|
if @photo.save
# add @photo's thumbnail to last import tag
format.js {
render :update do |page|
page.insert_html :bot...
A colleague needed to sort an array of ActiveRecord objects in a Rails app. He tried the obvious Array.sort! but it seemed surprisingly slow, taking 32s for an array of 3700 objects. So just in case it was these big fat objects slowing things down, he reimplemented the sort by sorting an array of small objects, then reordering the orig...
Hello.
I was wondering how other people implemented this scenario. I have an internal rails app ( inventory management, label printing, shipping,etc). I'm rewriting security on the system, cause the old way got to cumbersome to maintain ( users table, passwords, roles) - I used restful_authentication and roles. It was implemented about ...
I've Google around and haven't found much...
I'm trying to run script/server for my Rails project, and I get
Rails requires RubyGems >= 1.3.2.
Please install RubyGems and try again:
http://rubygems.rubyforge.org
gem --version Shows 1.3.6. Rails and all gems were installed using sudo. I'm on Mac OSX 10.6.
...
I'm trying to find out if Ruby has en equivalent of php's fopen() method currently used like this:
$fd = fopen("php://stdin", "r");
would that be using ARGV variable?
Basically what I plan on doing is forward raw e-mail messages using the .procmailrc file which I already got working in a test php file, but the project requires the us...
i managed to fix this issue but i wanted to document it here for any others whom might have similar problems.
I'm running a mediatemple (dv) rage server. monit started sending me alerts that i was having resource limitations on the server. logged into plesk and the CPU was pinned at 99.9%. Rebooted the server, catastrophe avoided...
...
Hi,
Need some help gathering thoughts on this issue.
Our team is moving ahead with the idea that separating the authenticated and public sections of our app in two separate folders will allow us to be more organized and secured.
I have seen this approach for Admin apps within the site but never for authentication.
We are currently usi...
I'm using the Ruby SVN bindings built with SWIG. Here's a little tutorial.
When I do this
@repository = Svn::Repos.open('/path/to/repository')
I can access the repository fine. But when I do this
@repository = Svn::Repos.open('svn://localhost/some/path')
It fails with
/SourceCache/subversion/subversion-35/subversion/subversion/li...
In irb, I do this
class Text
include FileUtils
end
I get: NameError: uninitialized constant Test::FileUtils
If I just do: include FileUtils (i.e. now class) everthing works.
What gives?
...
I have a rails app.
I have a file in #{RAILS_ROOT}/public/swfs/somthing.swf.
Locally, when running with webrick, when I go to the url
localhost:3000/swfs/something.swf, my swf loads just fine.
My routes.rb file looks like the following
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id'
map.conn...
I know a little bit of regex, but not mutch. What is the best way to get just the number out of the following html. (I want to have 32 returned). the values of width,row span, and size are all different in this horrible html page. Any help?
<td width=14 rowspan=2 align=right><font size=2 face="helvetica">32</font></td>
...