ruby-on-rails

ruby-debug install error: failed to build gem native extension

I'm running 1.9.2 with rails 3. I'm using rvm. I did: sudo gem install ruby-gem and got: Building native extensions. This could take a while... ERROR: Error installing ruby-debug: ERROR: Failed to build gem native extension. /Users/blankman/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb Can't handle 1.9.x yet *** extconf.rb...

Implementing Leaner CSS

For those of you who have implemented Leaner CSS for existing apps, I'm assuming that you didn't take your existing 1000 lines of CSS and migrate to Leaner CSS day 1. So how did you use the two in parallel? How did you setup your env to run off the old CSS file while also using any CSS written in LESS? Any good tutorials out there? ...

Rails: Implementing a search form for compound filtering

Hi all I have a model containing products. I would like to create a search form to allow users to apply compound filters to products as required. For example: Products with a price of between '10' (text field) and '50' (text field) with a colour of 'Red', 'Green' or 'Blue' (check box fields) and a weight of 'Less than' (select field) ...

LESS vs. COMPASS

For a rails CSS framework for an existing app, which one do you prefer - LESS or COMPASS? ...

Switching from plugin to gem -- issues?

What, if any, issues can you expect to encounter if you replace plugin with a gem version? For ex, paperclip plugin to paperclip gem. ...

Script block in content_for :in_script doesn't work

The script block begins with $('#map#{shop.id}')..... in content_for :in_script doesn't work. def edit_country_fields_template(city, shop) content_tag(:div, :class => "item") do "<div id='map#{shop.id}' class='map'></div>".html_safe + if shop.geocoded? content_for :in_script do $('#map#{shop.id}').gMap({ mar...

Rails: impact of lots of gems on performance?

What impact, if any, does having A LOT of gems have on the performance of your Rails app? ...

Questions on routing in Rails 3 with Devise

I have a few related questions. I am new to Rails 3 after taking a year-long break from Rails in general. I am using Devise for authentication and I have a controller and model called 'User'. So, I can use 'localhost:3000/users/sign_out' to log the user out. I want to put a link at the top right that says 'logout' so when they click on...

Rails Unit Testing - Cannot redirect to nil!

A contact has_many notes; notes belong_to a contact. In my notes controller, after a successful save of a Note, I redirect to the note's contact using: format.html { redirect_to(@note.contact, :notice => 'Note was successfully created.') } In my unit test, I'm testing the ability to create a note and redirect to the note's contact vi...

flexpaper for rails

hi guys, can someone out there help me out with understanding how to use flexpaper for my rails application? it needs swf formats, and our rails wud converted any supported file type to pdf. i'm clueless on how to proceed further with converting pdf to swf on the fly and displaying it via the flexpaper app. if any1s aware of this, ur hel...

Best way to deploy both Ruby 1.9.2 and 1.8.7 with RVM and Passenger on same server

I'm looking to deploy two rails projects. One with Ruby 1.8.7 and Rails 2.3.8, and another with Ruby 1.9.2 and Rails 3.0.1. I'm trying to set up a situation where www.example.com is Ruby 1.9.2 and shop.example.com is Ruby 1.8.7. What's the best way to set this up with Passenger and RVM? ...

Showing memory location instead of value in Rails

I have a block of this code in my helper: if !shop.directions.blank? "<ul>".html_safe + shop.directions.each do |direction| "<li>#{direction.direction}</li>".html_safe end + "</ul>".html_safe else "No directions available.".html_safe end + It's showing memory location of direction.direction like...

How do I test logout/signout (UserSessionsController destroy action) when using Authlogic?

I was writing an rspec test for the destroy action of my sessions controller (Authlogic 2.1.6). I can't puzzle out what method I should call, either on the user object or the session object to determine whether the session is still "alive" (that is, that the user is or is not logged in). My first instinct was to use @user.logged_in? bu...

rails documentation or faq addon

Before I roll my own I'm just curious if there are any other solutions similar to heroku's docs (sinatra) or the rails guides template for making a simple faq page for a rails app. I like heroku's on sinatra and have been currently using just a simple pages controller with markdown, but i'm looking for maybe something even better suited...

rails, rolling my own authentication system, what are security issues I should be taking into consideration?

Here is a list of security issues that my authentication system has to address (I know there are already plugins for this, I want to create my own -- I'm just like that! ((especially since I want to learn how to do it)). using rails form forgery protection storing a guid as the auth_token in the cookie, not the user id. Have this toke...

Is it better to create 2 actions, 1 for get and 1 for post, or can you just merge the 2?

Is it possible to have a controller action do both the GET and POST? i.e. the GET shows a form, and the POST takes the forms values and saves to the db. ...

Generating unique HTML ids in Rails when using a repeated partial that has form_for

I have a view on my current project which does something like the following(in haml): [email protected] do |horse| = render :partial => 'main/votingbox', :locals => {:horse => horse} The in the _votingbox.html.haml file I have the following: %div.votingbox %span.name= horse.name %div.genders - if horse.male %img{:src => '...

Checkers/Draughts Server and Board implementation (through a web browser using Ruby on Rails)

Hi I'm developing a two player checkers website. The idea is to allow people sign up and add to a list of friends they have. They can then send or accept requests to/from a friend on their list to play a game of checkers via the site. I'm using Ruby on Rails to develop it (It’s mandatory in case people think another language is more a...

web based games done in ruby, point me in the right direction

So I've been using a number of educational software web based apps, they are games, and they are all using flash. Recently I've seen some posts about making games with ruby. Are there any good examples out there for making games with ruby. I know of the game library, and then there is one book on amazon that has some awful reviews, and t...

Ruby on Rails download pdf link

Hi, I was wondering if there is a helper method, which can create a link to download a pdf file? Thank you, ...