ruby-on-rails

How to follow a redirect after click_link/button with cucumber and capybara in rails?

I'm currently trying to set up integration/acceptance testing for a new rails 3 application with cucumber and capybara. (I initially planed to use webrat, but it seems that it does not support rails 3, so I ended up with capybara) I'm trying to get a basic login test working: Feature: Login user In order to access the non-public part...

Is it possible to create a route like '~:id' in Rails 2.x?

I have been using the following route successfully in my Rails 2.x application: map.user ':id', :controller => 'users', :action => 'show' This, as my lowest route, properly catches things like /tsmango and renders Users#show. I'm now trying to add a second, similar route like: map.post '~:id', :controller => 'posts', :action => 'sho...

Nokogiri response different

Does anyone have a problem with Nokogiri acting differently between two servers (staging, and production)? On staging, it grabs and return the page properly (Nokogiri 1.4.2 Mechanize 1.0.0) On production, it returns a much smaller set of html that looks like a canned message (Nokogiri 1.4.2 Mechanize 1.0.0) I found out by running it i...

Using <string>.split (and a regular expression) to check for inner quotes

I'm implementing a search in my website, and would like to support searching for exact phrases. I want to end up with an array of terms to search for; here are some examples: "foobar \"your mom\" bar foo" => ["foobar", "your mom", "bar", "foo"] "ruby rails'test course''test lesson'asdf" => ["ruby", "rails", "test course", "test lesson"...

How to start developing rails/django application using NoSql Database like cassandra?

Hello i want to use NoSql database in my rails/django application for learning point of view. What the various things i should kept in mind. Any tutorials? things to be kept in mind? Any Tips like do and don't? EDIT I am fully flexible. I want to learn. I know php,rails,django.I want to create some application using Nosql database a...

How to implement search layer for Ruby on Rails site?

We are implementing a product review site using Ruby on Rails. Search is a core component of the user experience. We need to make searches fast and relevant. Should we use Lucene or another open source search layer? Should we use Google's search API and index against only our site? Or should we develop proprietary search functionali...

Rails or Django?

Possible Duplicates: Rails or Django? (or something else?) Django or Rails? I come from a PHP background and was planning to try out a new framework. I have never done Ruby or Python before. Knowing PHP, what language would be easier to learn? ...

Ruby on Rails Gem & Plugin Overload! Where/how to keep up-to-date?

I'm enjoying Ruby on Rails but one thing that seems overwhelming is the shear number of gems and plugins and their branches that exist out in the wild. Sure I could gem list --remote but that doesn't tell me squat other than confirming that there are hundreds (thousands?) of gems. How are people keeping track of what's hot and what's bee...

Why would Paperclip be failing to find the geometry key when on my server?

I'm getting an error in thumbnail.rb saying :geometry is empty Here's a condensed version of the stack: NoMethodError in PagesController#create undefined method `[]' for nil:NilClass RAILS_ROOT: ... Application Trace | Framework Trace | Full Trace .../vendor/plugins/paperclip/lib/paperclip/thumbnail.rb:18:in `initialize' .../vendor/...

Rails inherited resources usage

Hi, I'm using Inherited Resources for my Rails 2.3 web service app. It's a great library which is part of Rails 3. I'm trying to figure out the best practice for outputting the result. class Api::ItemsController < InheritedResources::Base respond_to :xml, :json def create @error = nil @error = not_authorized if !@use...

Rails schema not updating for a table.

I have a development env and a beta env for the app that i am building. Yesterday i came across a strange error. I wrote a migration to change one of the tables and it worked fine on my dev env. Once i deployed the changes to the beta env it ran and but when i access the page it started giving me trouble. The new columns that i added w...

Rails restful namespaces, resources... newbie question

I'm attempting to use nested controllers that have restful pathing, so that I'm all organized and such. Here's a copy of my routes.rb so far: map.root :controller => "dashboard" map.namespace :tracking do |tracking| tracking.resources :companies end map.namespace :status do |status| status.resources :reports end Li...

rails models - two tables have the same primary and foreign key fields

I am using an existing database with a rails app. I can't change the table or column names. Lets say table one is "invoices" and table 2 is "orders" they both have a primary key that is called the same thing, lets say "order_id" invoices can find its order by looking at the primary key "order_id" in the orders table. Vice versa fo...

Ruby on Rails + Cassandra on Netbeans?

This equation works good? Ruby on Rails + Cassandra on Netbeans6.9? I have try installing the gem activerecord-cassandra-adapter, but the installation never works good. Is there anybody using this? ...

To Ruby and/or To Ruby on Rails, that is the question...from a non-coder

I am a non-coder and am very good at HTML. I am going to self-teach myself Ruby & Ruby on Rails because I hear it's a good skill to have but especially because it may be an easy first language to learn with my HTML background. I would like to create my webpage, which will catalog my photographs, using Ruby on Rails. For a non-coder-HTML...

Emacs GUI for Mac, linux and windows

I'd like to start using emacs but I want also a GUI in which it will be available in windows, ubuntu linux (desktop) and mac osx. Is GNU/Emacs capable for this? What other choices are there and how different is for each OS? Also is there any disadvantages of using emacs with gui (for example, I can't use some kind of widgets or use som...

Mongodb , rails modify non-array - debug kind_of? Array >> true

I've been trying to add to an array (or what ruby is saying is an array), but keep getting an error from mongo which says Cannot apply $addToSet modifier to non-array when I try to run User.collection.update({'id'=> current.id},{'$addToSet'=>{ 'following' => current.id}}) User.collection.update({'id'=> user.id},{'$addToSet'=...

Ruby graphic libraries

What's the difference between RMagic, ImageMagick, GD, etc. and which one should I use? I was looking for a thumbnail generation script and noticed that every script I found uses a different library for the same thing. ...

Catching a database exception in a model.save or model.save! method?

Hello, I have two models that when saving certain types of data, it causes the database to throw an exception. I can convert the data before saving to avoid the exception, but the conversion is expensive and the exception happens very rarely. So, I was wondering if it's possible to create an override of the model.save method, and catch...

Getting absolute path to the file inside the public folder in Rails

What is the best way to get absolute path to the file inside the public folder in controller? Is there a predefined Rails variable that holds absolute path to the public folder? Currently I'm using File.expand_path('../../../public', __FILE__), but I'm sure there's a nicer way of doing this. ...