ruby-on-rails3

How to install mysql2 gem using bundler and capistrano

I'm trying to deploy a small rails3 app to a FreeBSD host using capistrano and bundler. I have added the line require 'bundler/capistrano' to my deploy.rb file, and bundler seems to work fine until it comes to the mysql2 gem. Here the install fails because the install script uses chmod and chgrp to try to install the gem with root:whe...

Static 'partials' in Ruby on Rails

Hello Rubsters So, I need to be able to display a small 'about our products' blurb on every single one of the product pages. I also need this blurb to be editable through the app interface, and not appear as a static page alone. I have a static Page model with title, permalink, and content; and PagesController set to find_by_permalink ...

paperclip - Saving the images Dimentions? width,height

Hello? Any paper_clip wizards out there know if you can when using paperclip to save an image, also save the image dimensions (width&height) in 2 extra fields? How do you get such data during the paperclip upload process? Thank you ...

Ruby / Rails - .each Iterator is printing entire array at the end of the loop.

I think what I'm trying to do is pretty simple, and I'm really not sure why this isn't working. I'm using Rails 3. Essentially, I'm just trying to select the distinct values from a column in an existing model, and print them out all. For the most part, this works but the .each loop in my view also ends up printing the entire array at t...

Rails - AJAX a Modal Dialog?

Hello, I'm interested in learning how to AJAX a modal dialog. Typically if I wanted to add a modal dialog to my web site I added the jquery UI dialog code in my main JS file and binded it to an ID. I believe with Rails I can create a Link, which fetches all the dialog code from the server and then opens the dialog. Is this true? If so...

Calling a controller's action without a named route in Rails 3

In Rails 3, is there a way to link to a controller's action using ajax without having a named route? I tried <%= link_to 'Reload', '#', url_for(:action => :reload, :id => @user.id), :remote => true, :method => 'post' %> but it returns with the error No route matches {:controller=>"users", :id=>2, :action=>"reload"} My main concern is...

Rails 3 Engine - Provide Config For Users

I can't seem to find any documentation on how to do the following: I need to provide a config variable for any applications using my engine so that they can easily pass settings to my engine. Does anyone have any links to a proper or accepted way to do this? EDIT: As an update, I figured out a decent way to do this. Code is below. # f...

rails to_json not following scropes

When I just the to_json method it seems to ignore all other options... any ideas how to fix this? var places = <%=raw @location_for_map.limit(5).to_json(:only => [:name, :lat, :lng]) %>; I'm trying to plug in points from json on a google map, but noticed the points never got smaller with any of my scopes. where, order, limit... I cou...