ruby

Ruby on Rails - Locomotive for version 2.3.8 -- is there such a thing?

I am looking for a piece of software that will allow me to use Ruby on Rails 2.3.8 on top of MACOSX - basically, I teach at a college where students are not able to get terminal acccess to the rails built into OSX so I am looking for a piece of software like "Locomotive" that is an app that allows students to use rails without administra...

range based on date when not within a month doesn't work (ruby)

I want to find out files that are older than x days (time and weekends don't count for the purpose of calculating a file's age). I need to use only weekdays. My script is working but only if the date from the range are within the same month. Otherwise the range size is 0. I run the script via ruby 1.8.7 (2008-08-11 patchlevel 72) [x86...

Is there an exit in ruby?

I use php and there is a handy exit; that will stop the execution of the page and let me view the page thus far and then lets me view the debugging that i need ..anything like that in ruby on rails ...

Development VPS where environment (Ruby/Rails, Javasciprt/Node.js etc) is pre-installed?

Until now I'm setting up my own development environment with Vagrant/VirtualBox/Chef (Ruby). I wonder if there is a hosting company that provides pre-configured VPS for... Ruby/Rails Javascript/Node ...letting me just choose what I want to have installed and also which linux packages I would like to install in each VPS. Are there h...

how to code web/application server in ruby?

I need to run ant remotelly create/modify xml files for ant pass back results from ant's execution so I thought I am going to write a web/application server in ruby. But I do not know where to start. The computer that will run ant is Win XP SP3 and there is no web server or anything else running. I found this code but not sure wh...

grabbing text between two elements in nokogiri?

<body> <div>some text</div> I NEED THIS TEXT ONLY <div>some text</div> more text here <div>some text</div> one more text here <div>some text</div> </body> How? ...

How does one create a scope to find "Authors who have zero posts"?

Using Rails 3, this scope works as would be expected: scope :with_posts, lambda { joins(:posts). select("authors.*, count(posts.id) posts_count"). group("posts.author_id"). having("posts_count > 0") } The generated SQL is: SELECT authors.*, count(posts.id) posts_count FROM `authors` INNER J...

Good & Simple Ruby XML writer?

Anyone know of an easy to use Ruby XML writer out there? I just need to write some simple XML and having trouble finding one that's straightforward... ...

Ruby 1.9 Kernel::system not working on Windows

I use system "java -cp xxx.jar" in my ruby script and it runs well on Mac OS. But when I run the script on Windows 7 x64, those java -cp xxx.jar did not get executed and no error was reported. ...

ActiveRecord::RecordNotFound in MembersController#show

Hi, I am sorry for my bad english first. I just installed ruby and rails few hours ago (you wouldn't believe it took me 3 days to install ruby,rvm,rails and etc, on this ubuntu 10.04 machine) and I am trying to implement basic Member scaffold. My version of rails is 3.0.0 and my ruby is 1.9.2. When I #rails generate scaffold Member em...

How to generate documentation with Yard for Rails views?

I have just started using Yard to generate my docs and whilst it works great for my models and controllers, I can't seem to get it to generate anything for the views I've tried a variety of different ways to get it to work. Currently I've set up a rake task to generate the docs that looks something like this YARD::Rake::YardocTask.new...

click_link image in cucumber

<a href="/videos/21-running"> <img height="120" src="/images/sample-image.jpg" alt="Running"> </a> Please support me a way click link in cucumber by alt or src. Thanks. ...

Development workflow for Heroku?

I have used Heroku to push up my already coded Rails applications. But now I wonder how the workflow would look like if I start coding a new Rails application from scratch. For example if I use their addons (MongoHQ, Redis, Websolr, Sendgrid etc) in my application code, then I guess I shouldn't install MongoDB, Redis, Solr, Mail server...

Is there easy way to search in fetched records?

So, I want to search in fetched records: p = Product.added_today # Get records by scope # wants something like p.search(:name => 'Clocks') Is there easy (rails way) to do it (gem or something)? ...

Alternative for ssl_requirement plugin for Rails 3?

I have used ssl_requirement plugin for previous versions of Rails and it is awesome. But for Rails 3 I want to try out some new plugins or gems. Any suggestions? ...

What is the Ruby regex to match a string with at least one period and no spaces?

What is the regex to match a string with at least one period and no spaces? ...

How to use a variable as object attribute in rails?

I have a PaymentDetail model with attribute 'home_address_country', so i can use @payment_detail.home_address_country //where @payment_detail is object of that model. I want to use something like this:--- country_attribute=address_type+"_address_country" //where address type is equal to 'home' @payment_detail."#{country_attribu...

Open pptx in PowerPoint 2010

I try to open pptx file in PowerPoint 2010 programaticaly from Ruby using win32ole @power_point = WIN32OLE.new('PowerPoint.Application') @power_point.Visible = true @power_point.DisplayAlerts = 1 # ppAlertsNone @power_point.FileValidation = 1 # msoFileValidationSkip @doc = @power_point.Presentations.Open(win_path(path), 0, 0, 0) @doc.Up...

Exception when using httparty for itunes verification

Hi all, Here is a piece of code I wrote to implement itunes_verification. http://gist.github.com/raw/622038/b32accd30e86f7c714f2cffefd19857f558c8d97/gistfile1.rb ItunesVerification.verify_apple_receipt("wefwfrw") But, its always throwing {"exception"=>"java.lang.NullPointerException", "status"=>21002} from the itunes server. "java.l...

Using the URL option in a form_for

I have a form with a url option. - form_for [@organization, @video], :url => organization_media_videos_with_session_path(@organization), :html => { :multipart => true } do |f| That URL is specifically a helper that I wrote here : def organization_media_videos_with_session_path(organization) session_key = ActionController::Base.sess...