ruby-on-rails

jQuery and Rails

I'm writing a Rails app and need to plug in this little bit of jQuery code, but I don't really know how to get it to work. Here's my controller code: class ChatroomController < ApplicationController def send_data @role = Role.find_by_id(session[:role_id]) render :juggernaut do |page| page.insert_html :bottom, 'chat_data',...

ActiveScaffold and associations

My model "combobox" has_many "comboboxselects", and "comboboxselects" belongs_to "combobox". Activescaffold of "comboboxes" displays data in comboboxselects-column like "#<Comboboxselect:0x472d25c>". How to make display the "answer" column from table "comboxselects"? Models: class Combobox < ActiveRecord::Base has_many :comboboxselect...

Simple Captcha - How to test ?

I am using Simple Captcha plugin for generating the captcha. Does anybody know how do I modify rails tests to handle this? ...

Create an ActiveRecord database table with no :id column?

Is it possible for me to create and use a database table that contains no :id column in ActiveRecord, Ruby on Rails. I don't merely want to ignore the id column, but I wish it to be absolutely non-existent. Table Example :key_column :value_column 0cc175b9c0f1b6a831c399e269772661 0cc175b9c0f1b6a831c399e26977...

Converting Database Structure/Data in Rails

This is kind of a follow up to this question: http://stackoverflow.com/questions/849897/can-rails-migrations-be-used-to-convert-data If I'm working on a branch that, when it is re-integrated and released to production, will change the database schema quite drastically. What is the best way of ensuring that all the data in production get...

Ruby on Rails, ActiveRecord, Binary search.

If I had the following table. create_table :my_table, :id => false do |t| t.string :key_column t.string :value_column end How would I ensure that the rows are optimaly stored for binary search by the field of :key? And how would I make sure binary search is used? ...

can users who have used both Django and Ruby on Rails give a little comparison of using them?

Duplicate: Django or Ruby-On-Rails? I have been reading on Ruby on Rails, and it seems like on some threads, some users like Django a lot too? Can someone who have used both give some insight about using them, such as ease of use productivity fun factor deployment issues or any other framework you'd highly recommend? ...

How do I alter request parameters before posting XHR action in Ruby On Rails?

I have a form with a list of people with check boxes next to them. Then I have a submit_to_remote which will pass the checked people into the controller for processing. It currently passes checked people in the form: checkbox_name => checkbox_value where checkbox_value is the person_id. This comes from prototype using parameters:For...

Generating migrations from Rails schema updates, instead of the other way around

I hate writing migrations, but it's important for the schemas to stay in sync. What I'd much rather do is update my schema.rb and have Rails notice, then run something which generates the appropriate migration based on the difference between the old version and the current version. Is there a way I can do that? ...

rails: how to not include some db attributes in model

Hi, My DB table has a column that can contain a very big amount of data. I do not want this data to be part of the corresponding rails object (model). How do I tell in the model that I do not want to store this field in memory ? Initially this comes from the fact that I have a session bigger than 4k and rails raises a ActionControlle...

Allow the user to pick a named scope via GET params

In my posts model, I have a named scope: named_scope :random, :order => "Random()" I'd like to give users the ability to get posts in a random order by sending a GET request with params[:scope] = 'random'. Short of eval("Post.#{params[:scope]}"), how can I do this? ...

What are some good role authorization solutions used with Authlogic?

I am looking for a good role based authorization solution to use alongside Authlogic. Anyone have any good suggestions? Please list some pros and cons from your experience if possible please. ...

How do I round numbers up to a dynamic precision in Ruby On Rails?

I want to round numbers up to their nearest order of magnitude. (I think I said this right) Here are some examples: Input => Output 8 => 10 34 => 40 99 => 100 120 => 200 360 => 400 990 => 1000 1040 => 2000 1620 => 2000 5070 => 6000 9000 => 10000 Anyone know a quick way to write that in Ruby or Rails? Essentially I need to know the ...

What is the PHP or C# Equivalent of Ruby's Depot Application?

The book Agile Web Development with Rails has a great application that it takes the reader through to introduce them to the process of developing a real application with Ruby on Rails. Does PHP or C# have an equivalent? At the very least, can anyone think of a good practical exercise for learning PHP or C# "as you go" or through applic...

Do rails rake tasks provide access to ActiveRecord models?

I am trying to create a custom rake task, but it seems I dont have access to my models. I thought this was something implicitly included with rails task. I have the following code in lib/tasks/test.rake: namespace :test do task :new_task do puts Parent.all.inspect end end And here is what my parent model looks like: class Pa...

Rails RR Framework: multiple calls for instance_of

I would like write RSpec for my controller using RR. I wrote following code: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RegistrationController do it "should work" do #deploy and approve are member functions stub.instance_of(Registration).approve { true } stub.instance_of...

how to configure a rails app (redmine) to run as a service on windows?

I'm using redmine as a ticket manager, and I'd like to configure it to be run automatically when windows starts up. How can I configure it to be run as a service? -- Just asked the question to document it, I hope somebody may find it useful... ...

Installing rails plugins as git submodules

(Why there is no|Is there a) way to run ./script/plugin install -SOME_HIDDEN_OPTION git://github.com... So that the plugin is installed as git submodule. The reason for submodules is to keep unrelated code off project's repository. Perhaps there is a reason not keep plugins as submodules? ...

How to get a method to detect 'remote_form_for' usage?

New to Rails... here goes: If I want my 'create' method to respond differently to an AJAX request than to a normal POST request, can I have the method detect which was used? Or, is it better to use different methods for AJAX and non-AJAX requests? Thanks for your input. ...

How to deploy Rails 2.3.2 app with Capistrano from the top (for FastCGI)?

...