ruby-on-rails

how to build comments in a blog for a rails application?

i am building a blog and would like to know good tools and plugins to implement a commenting system. ...

Group by multiple columns in ActiveRecord

Using Rails 3.0, i'm trying to do a count on number of times a each combination of column1 and column2 occur. IE Column A has values A-Z and Column B has values 1-5, i want a count of A1, A2, etc. Is there a way to either group by multiple columns or join the two columns and group of the result? In reading the documentation, it wasn...

Rails 3 and Passenger/Apache

We are developing a new rails application and are considering moving to Rails 3. We have the following questions: Does Passenger support Rails v3 + Ruby v1.9.2? Does Rails v3 provide a significant performance improvement over Rails v2.3.8? Thanks. ...

Rails image uploader and EXIF data reader?

Any decent paperclip-like Ruby gems that also read EXIF data? It would be a huge bonus if the gem was Windows-friendly. ...

Model Using Modules in Rails Application

I have a model that requires loading external data from an auxiliary source. A number of web services exist that my model can fetch the data from (swappable), but I don't want to create code that will make it difficult to change services (costs significantly differ based on variable and fixed usage and it is likely changing will be requi...

Migrating from Rails 2 to Rails 3

What resources are out there (free or paid) that help walk you through the process of migrating a Ruby on Rails 2 application to Rails 3? I've seen some blog posts (some of which seem out of date) and an eBook for sale somewhere on the RoR website, but what can you recommend as an accurate and complete explanation of what changed from ve...

Rails 3 & jQuery - How the two work together to create a web app?

I need helping understanding the end to end flow in Rails. I could use help with the following example.. Lets take Facebook. When you're on Facebook.com, and click MESSAGES, the URL changes to (facebook.com/?sk=messages) and then AJAX is used to download the HTML/ JS content which is injected with JavaScript into the content pannel.....

How to set up a proper select form..

I am trying to draw the end result being that @gallery = whatever i choose in my select - form_for :gallery do |f| .grid_6.hr_dots.clear .exist_gal .grid_5 %label 2. Or add to an existing Gallery .clear .grid_4 = select @gallery, :gallery, options_for_select(@galleries.collect { |g...

Recommended server layout/architecture for Rails application

What is the recommended server layout for a production Rails application that is expected to receive medium (not heavy, but not light either) traffic? I'm thinking of a setup running Apache and Passenger (mod_rails). How many application servers, web servers, and database servers make sense? How should they be set up to provide redundanc...

How do I set up a named route in rails 3?

This is a month long thing I've been putting off, and I can't for the life of me figure this bugger out. I'm tracking to access a file in website/admin/organizations/org_deals My routes look like this : map.namespace :admin do |admin| admin.namespace :organizations do |organization| organization.org_deals 'org_deals', :action =>...

Writing ruby web-service. What architecture should I use? Rack, Rails-engine?

I need to write web-service that will get files over http and convert them. This service in future might be included in rails application. I wonder what I need to use for that? Mount as Rack-middleware? Sinatra app? Write Rails-engine? Simple ruby script with networking? Anything else? Thanks ...

Rails: resources for unorthodox urls?

Hi! I'd like to have a URL like this: /payroll/region/1 and I'd like it to map to the Tasks Controller's payroll_list function. I'd also like to use REST. What's the best way to do this? Many thanks! ...

Rake task to add default data

I have seen some apps that have a few rake tasks included to load data. I am not talking about seed data, I know about db/seeds.rb, instead I am referring to data such as default users and basic records that help me fill my application with something to look at. I don't want to use db:fixtures:load because I don't have any control over...

How to generate a page header on each PDF page with Ruport?

I am generating a PDF report with a basic table, and page header on each page. Ruport mentions the ability to generate page headers by using top_margin and its extenstion with the all_pages command (ruportbook.com/printable_documents.html in the section labeled Generating Page Headers) However when I use the example in my existing cod...

How to render partial in page from rails controller without prototype helpers

I'm removing Prototype from my Rails 3 app in exchange for jQuery and trying to figure out how my controller should update part of the html page without using this Prototype helper: page.replace_html( "content", :partial => "day" ) ...

SEO/Rails - How to add the title tag to every "link_to"

Hey, I'm surprised Rails creator didn't think about that, if someone can help, would be great. How can we do to change this: <%= link_to "My Title", :controller => "products" %> to this automatically: <%= link_to "My Title", :controller => "products", :title => "My Title" #basically a copy of the text %> I think it could help...

Dropdown menu on rails

I need to make a simple dropdown menu to my rails app, but all i can find is dropdown selects. does any1 know a good guide on making dropdown menus? just a simple menus, nothing fancy ...

Rake on Rails 3 problem

Hi, I moved a Rails 2.3 application to Rails 3. The application actually works perfectly, but I have issue with rake tasks. It looks like the config in the environment file is not initialized correctly. the error I get is: rake aborted! undefined method `cache_classes=' for #<Hash:0x3c3e850> /var/www/apps/nzar3/config/environments/devel...

Ruby on Rails div_for within an each block is not producing correct id and class

I'm trying to generate some divs using div_for inside of an each block. The result is that every div has the same id and class. The documentation says that each div should have a unique id (which is what I want). Here's the code I'm using: <% @pallet.boxes.each do |box| %> <%= div_for(box) do %> <h2><%= box.name %></h2> <p>some st...

How to make these RSpec tests more DRY in Rails

I have a bunch of recurring tests for some of my controller actions, all of which require authentication. As a result, you end up seeing a lot of code like the following: describe "authentication requests" do it "should return 401 for unauthenticated :show" do get :show ... end it "should return 401 for unauth...