ruby-on-rails

Help with rails rest standard

I have a messages controller thats declared as a resource in my routes. I want to be able to have a list view of received messages and a different view of sent messages. But I dont want to break the rest pattern... What do you guys reccomend? ...

Can anyone please help me with this SQL Query (works in SQLite DB Browser, but not in Rails)

Rails has been spitting this out to me: SQLite3::SQLException: near "SELECT": syntax error: SELECT questions.id, questions.text, questions.question_type_id, questions.meta, questions.max_answer_length, COUNT(form_questions.id) AS expr1, (5) AS expr2, CAST(COUNT(form_questions.id) AS REAL) / CAST((...

Make a JavaScript Auto generator for visitors to my website

Hi, I have a website that stores quotes and users can add some quotes to their favorite list. I want to be able to let those users generate a JavaScript snippet to put in their blog or website and this JavaScript will display their favorite quotes one by one every set period of time say 60 seconds. I have been using Ruby on Rails which...

preserve object ruby on rails

Hi I have an object in ruby on rails for @user which contains username, password, etc How can I ensure that the values are kept throughout all views? Thanks ...

Do I need to require original file when overriding controller from Rails Engine?

I'm trying to override an action in a controller defined by a Rails Engine. It seems like I need to require the original file before reopening the class, like so: require File.join(RAILS_ROOT, 'vendor/plugins/myplugin/app/controllers/some_controller') class SomeController def index render :text => 'this is my index' end end ...

mysql + ruby = nightmare

Ok, I'm done. I can't understand why I got this error with: rake features It cant' be I can't connect to mysql cause the: rake db:migrate works perfectly. I keep having this error: rake features --trace (in /Users/myname/Projects/rails_app) ** Invoke features (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_...

flickr-fu simple example not working

Hi, I'm using flickr-fu gem within a rails application for flickr api integration. I'm following the sample code for setting up a web app shown below: def flickr_create flickr = Flickr.new(File.join(RAILS_ROOT, 'config', 'flickr.yml')) redirect_to flickr.auth.url(:read) end def flickr_callback flickr = Flickr.new(F...

How to call a C# dll in ruby?

How to call a C# dll in ruby? ...

Rails and actionwebservice: SOAP version 1.1 and 1.2

I am using SOAP web services with a Rails application. The rails application is the server in this instance; clients are mixed platforms. I am using datanoise-actionwebservice 2.3.2 and Rails 2.3.5. I want to know how to alternate between publishing a SOAP 1.1 and SOAP 1.2 web service, or even if this is possible. Help appreciated. ...

(rails) validating URL help with regexp

i'm using the following to verify if a URL is formatted validly: validates_format_of :website, :with => URI::regexp(%w(http https)) however, it doesn't work when the url doesn't start with http:// or https://. Is there some similar way to validate URLs with URI::regexp (or URI) and make it include valid URLs that don't start with http...

Can I Program a Website with Ruby on Rails and NOT have Speghetti Code?

I have abandoned php because it was a nightmare to maintain. I then reprogrammed the whole site in asp.net C# Which is so much better. The maintenance is a breeze. I have lately been hearing alot of good stories about RoR but I don't want to develop software in this language if it is like PHP speghetti code. So, can I make web applicatio...

String comparison in Ruby on Rails unit-test

Hi, my Ruby On Rails unit-test fails in a simple string comparison and I can't figure out why. In the model TestItem, I have doc = REXML::Document.new(data) @bugtitle = doc.root.get_text("/bugzilla/bug/short_desc") where data is a xml-string returned by a Net::HTTP::post request. The data looks good, and if I output @bugtitle it cont...

(rails) weird problem with url validation

i'm trying to see if a url exists. here is my code for doing so: validate :registered_domain_name_exists private def registered_domain_name_exists if url and url.match(URI::regexp(%w(http https))) then begin # check header response case Net::HTTP.get_response(URI.parse(url)) when Net::HTTPSuccess then true ...

Rails has_many through singular association

This is probably quite simple but I haven't yet been able to wrap my head around the problem. I have 3 tables... (well more than that) but in this scenario 3 that matter. Places Bookings and Ratings Places has_many bookings Each booking has_one rating (because the user only rates once) and belongs_to (a) Place Ratings belong_to (a) ...

How to read trace for a failed Rails migration related to Lockdown gem

More often than not, when i get an error the trace will point to a line in my own code. I'll go to that line, find the error and fix it. However, right now the trace is pointing to Rails and gem code, and I'm not sure how to use it to debug my work. I've been following the steps listed here. When I run rake db:migrate --trace, I get ...

Write current svn version into text file

I have a rails site. I'd like, on mongrel restart, to write the current svn version into public/version.txt, so that i can then put this into a comment in the page header. The problem is getting the current local version of svn - i'm a little confused. If, for example, i do svn update on a file which hasn't been updated in a while i...

How to assign columns as dates in rails

Hi guys in Ruby on Rails I have a table with 7 columns such as Monday, Tuesday, Wednesday etc which hold times... I want these columns to be assigned to an actual day of the week so that if its tuesday the tuesday columns data(times) is rendered etc how do i go about doing this thanks in advance. ...

Multiple databases in Rails

Can this be done? In a single application, that manages many projects with SQLite. What I want is to have a different database for each project my app is managing.. so multiple copies of an identically structured database, but with different data in them. I'll be choosing which copy to use base on params on the URI. This is done for 1. ...

know the domain of the action called in rails

I have 2 domain: domain1.com and domain2.com how can i know what is the domain that the user used to call a action? like domain1.com/controller/action i want get domain1.com from the action is possible? thanks ...

Caching dynamic images in Rails

I am using the rmagick gem for generating dynamic images from a controller. The controller takes an id as a param, does a look up on a model, writes text over an existing image, and outputs it. I have run some benchmarks comparing generating it for every request versus writing to disk and using send_data to output it if it already exist...