ruby-on-rails

Is it a bad idea to open a separate MySQL connection inside Rails' environment?

I'm in a situation where I need to make a call to a stored procedure from Rails. I can do it, but it either breaks the MySQL connection, or is a pseudo hack that requires weird changes to the stored procs. Plus the pseudo hack can't return large sets of data. Right now my solution is to use system() and call the mysql command line dir...

RoR Server Construction and Capistrano Support

I have been creating a website with Ruby on Rails, and will be hosting it through a friend. He has the space and capacity to host the server, and I have a system to devote to being a dedicated server. And this is my first attempt at a Rails website, plus self-hosting with a friend. I will be formatting and preparing the server today a...

Why is the Rails Inflector module deprecated?

I looked in the Rails docs under inflector and found this message... Module deprecated This module is deprecated on the latest stable version of Rails. The last existing version (v2.1.0) is shown here. There was no explanation or reference to any further detail. I recalled seeing a Rails Trac website. I hunted that down and f...

When does the comment block with schema information for the model get updated by rails?

In some Rails model definitions, there is a comment block at the top that contains the schema information. # == Schema Information # Schema version: 20090122060318 # # Table name: table_name # ...

Is there a good tool to generate an image of the database schema used in a Rails app?

Is there a good tool to generate an image of the database schema used in a Rails app? ...

Can Ruby really have design issues that the design patterns solve?

I recently started digging into design patterns. Generally speaking, I thought the design issues that most of the design patterns solve do not generally occur in Ruby. Most of the design issues were because of datatypes (No dynamic typing and arrays can hold objects belonging to same class at a time etc. and many more.). Being a ruby and...

Preload Model Associations On Find

Right now I am trying to call my model, and spit out its results into json/xml format. My only problem is, my database associations aren't being loaded or queried. Normally, I can just run this @campaign = Campaign.find(:all) Then get the number of hits by calling, @campaign[0].hits through the has_many :hits. But if you debug the ou...

What's Django's equivalent of "replace_html" in Rails?

I'm wondering what a controller - such as the following Rails controller - would look like in Django, to perform an ajax update of the page after an asynchronous form submission (assuming the following is correct): def create @omelet = Omelet.new(params[:omelet]) render :update do |page| if @omelet.save page.replace_html 'notice',...

Unit Test for a Model that acts_as_tree

How could i test a model that acts_as_tree in a unit test ? ...

Anyone know of a simple way to store the Rails Page cache on Amazon S3?

I am looking for a simple and automated way to store the page cache on S3 (and of course cloudfront.) I know of a plugin that does this with the fragment cache, but before I create it myself, wanted to tap into the collective wisdom here :) Edited: To make myself more clear, I am not looking to use S3 to serve the files, but rather, th...

Preserving sessions when using multipe domain names for one Rails app

I have a single Rails 2.2.2 app that I want to 'share' with multiple clients. Each client has his own domain name and database. The purpose is to allow one Rails app to 'host' many websites. I am using Apache as a front end to a mongrel cluster, as the web server. To enable Rails to know which request is for which client, Apache adds a ...

:through relations in rails: query by attribute in related table

Hi, I have the following Rails definition: Class Book string title has_many readings has_many users, :through => :readings Class Reader int rating belongs_to :book belongs_to :user Class User has_many readings has_many books, through => :readings No I want to query like this: Give me all readings ratings for user A that have book.t...

Padding-background/text filler in CSS?

I'd like to create a table that looks like this: lolvalue---------|lol date|some other column data 1 lolvalue12345|lol date 2|some other column data2 in CSS/HTML. Basically, there is "data" and there is a filler that goes to the right, but doesn't count as data, so it doesn't stretch the column, filling the space stretched by the ...

Are There Any Good Ruby, Rails or .Net Libraries for Working with Barcodes?

Does anyone know any good Ruby, Rails or .Net specific libraries for working with barcodes? ...

Accessing Word documents in a Rails app

I have a number of documents (mainly Word and Excel) that I'd like to make available to users of my Rails app. However, I've never tried something like this before and was wondering what the best way to do this was? Seeing as there will only be a small number of Word documents, and all will be uploaded by me, do I just store them somewhe...

How do you handle 'actions' on resources in a RESTful design, like marking an email read?

How would you integrate things like this in a RESTful design? Marking an email as read Voting on a story Reporting a message as inappropriate Additionally, how would you do it in such a way that one could make a small icon link or button to do the action without too much wizardry? ...

Login/Register in Ruby on Rails?

Im starting to learn RoR and i want to make my personal blog in this language. I usually code a couple of prototypes on top of whatever im doing in my blog. So i would like people to be able to log in, and register with their openID. So i was about to jump to the coding place when i realized the concept of gems and all that stuff is giv...

Rails and javascript cache

Hi guys, I'll start to develop a new app that uses a lot of heavy js librarys (prototype, scriptaculous, tinymce and so on). Someone told me to make all the app using ajax, so all the js files will be loaded only once. My question is, I really must do everything on ajax? Lets say if I call myapp.com/projects and projects use all thos...

Beyond stumped; Odd JQuery Cycle behavior in IE

I'm using the JQuery Cycle Plugin in an attempt to fade in/out images for a slide show. I am able to get it working in Firefox and Safari, however, when I view in Internet Explorer, I see very unexpected behavior. In Internet Explorer, the cycling is happening as expected, but some of the images do not display. They simply display a r...

Ruby on rails language question

Im creating a fast application with ruby on rails, and after doing a lot of scaffolding and validation im very happy with some of the features that are embeded in RoR... but i live in mexico and all my users would love the application to be in spanish of course. So, i noticed theres a lot of functions that write actual text in english fo...