ruby-on-rails

Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010

When i'm running ruby script/server webrick -e production it gives error => Booting WEBrick => Rails 2.3.5 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #...

How do I add a user model to my application so data is "user" specific in my Rails app.

Hi, looking to see if there are some ideas on how I should introduce the idea of a logged-in "user" that effectively 'federates' the data....let me explain. I have been building my app so far as if there is only one user. Me. All the data and reports are specific to me. I just added authlogic. I now want to be able to introduce a wa...

How to use a Range data-type in Rails model creation?

Am using Rails version 3. I want to create a model , in which i have a field called "Page-visits" I want it to hold range as value, eg: (50 .. 100) , (1000 .. 5000) etc. How to achieve this ?? Even if there is no such data-type at present in rails, I would like to know other ways of how to achieve this ? ...

Rails 3 Custom Routes Parameters

I want something like this in my routes.rb. This isn't at all correct, but something like this: match '/:scope/authenticate' => '%{:scope}_authentication#create' So going to /users/authenticate would route to the create method in the users_authenticate controller. What is the best way to do this in Rails 3? ...

apache says my DocumentRoot directory doesn't exist

I am using Phusion Passenger to deploy a rails application using apache2 on CentOS 5.5. For some reason, I keep getting this message when I start up apache: > service start httpd Starting httpd: Warning: DocumentRoot [/home/deploy/my_app/public] does not exist [ OK ] The directory most certainly does exist. Here are some important ...

Capistrano + NGINX Passenger Restart Rails App

Hey Guys. I've finally gotten capistrano to work on my website, however, I cannot seem to get the restart part of the application to work. What I want todo is setup capistrano to restart the mongrel cluster that is running the rails app after a deploy has gone through. Since I used passenger to install everything, I have no clue how to ...

Rails destroy all but newest n records

How do I destroy all but the newest n records using Rails' ActiveRecord? I can get the newest n records using order and limit but how do I destroy the inverse? ...

gem installed but 'rails' commands don't work

when I run any rails command like rails s I get the following error: Could not find diff-lcs-1.1.2 in any of the sources Try running bundle install. However, I already installed diff-lcs. bundle show diff-lcs /opt/local/lib/ruby1.9/gems/1.9.1/gems/diff-lcs-1.1.2 I also see diff-lcs when I do a gem list command My GEM_HOME is /...

Is there a clean Rails way to set attributes when creating join models?

I'm using Rails 3 and have a rich association between Projects and Users. The join model (UsersProject) has an additional boolean attribute, administrator, which flags the User as an admin of Project: Sure I'm missing something obvious here, but is there a clean way to set the administrator attribute on the join model (UsersProject) whe...

rails, preview button in form question

Hi, I am trying to set up a preview button in an edit form based on the railscast by Ryan Bates. There are two buttons [edit] and [update]. When the user clicks the preview button, the "update" function in the controller is called. If I simply set the @article variable based on a find of the article table (as per below controller) th...

Building a RESTful delete method URL for a model association

I'm attempting to build a proper RESTful approach at removing a friend while looking at their profile page. I've used this Railscast episode as the basis for my self referential Friendship model, but his approach differs in that he has a page listing all the friendships, with a delete button next to each one. Since he's already iterating...

Python, Ruby or Objective-C for newbies

I'm a Web designer who want to start learning a new language, I'm familiar with C#, Asp.net and C and decided to choose between Python Ruby Objective-C I need to learn this because of academic reason and I'll use this to implement some small project at university , I'm really free to choose and I have no idea about these. Here are 2...

Paypal X - adaptive payments - what is this?

I'm a little confused, all these different types of product and it sounds like it will do all the same thing? Can someone please explain to me in plain english what are the differences between these products? what can you do and cant you do with each product? Example of where it's used. Adaptive Payments enable developers to build apps ...

Error -bash: ≈: command not found when starting a new bash after installing RVM

I installed RVM, and updated my .bash_profile with: [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" I get this error when opening a new terminal now: -bash: ≈: command not found what could be the reason? ...

How to remove a column from my Rails model ?

I need to remove a few columns from my rails model which i already created and have some row entries in that model. How to do it? Any links which has details for modifying the schema in rails ? I'm using rails version 3. ...

rails nested form, create and then update new associated models without page reload

Relevant info I have a User model with plenties of attributes and several has_many associations. I have a BIG form to edite existing user info, including nested fields. I have divided the form into several forms in different divs and show only one form at a time. (i.e. tabs in UI) User can save info by clicking Save button, which subm...

What am I doing wrong with this query?

Goal: to get a list of N random questions that have been answered correctly the least amount of times, per user. following sql will provide me a list of having a count of correctly answered questions for user_id 4. select q.id, temp.Count from questions as q left join (select q.id, count(a.id) as count from questions as q left join att...

rails twitter_oauth library uninitialized constant

I'm trying to use the twitter_oauth gem : http://github.com/moomerman/twitter_oauth In my model I have: require 'twitter_oauth' And within a function I have: def example client = TwitterOAuth::Client.new( :consumer_key => 'xxxx', :consumer_secret => 'xxxx', :token => "xxxx", :secret => "xxxx") return client end ...

Rails and Facebook connect. Please help!

Hello! I am developing in Rails 3 and I need to use the Facebook connect API (Graph). I am currently trying out the Javascript SDK and it works fine. The problem is I do not know how to "save" and interact with the information I extract in Rails. The best thing would be to use some "native" Rails plugin for Facebook. I have looked a bi...

'Unknown key(s)' ArgumentError

I'm working on a moderating feature for my application, which is based on a basic scaffold structure. What I need, is to edit several records with the boolean parameter publised on false. In moderate.html I'm getting the list of all unpublished entries with the ability to change their parameters which, what and published. The error appea...