ruby-on-rails

Modeling a cellphone bill: should I use single-table inheritance or polymorphic associations?

In my domain: Users have many Bills Bills have many BillItems (and therefore Users have many BillItems through Bills) Every BillItem is one of: Call SMS (text message) MMS (multimedia message) Data Here are the properties of each individual BillItem (some are common): My question is whether I should model this arrangement with s...

Is there a Rails plugin or Ruby gem that offers similar functionality to Django's built-in Admin Page?

Reading about Django, I saw this: http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#ref-contrib-admin - the fancy simple to use admin page that django can magically create for you. Is there a plugin or gem offering similar functionality in Rails. Are there any plans to make Rails do this for you in the future? ...

rails Creating a model instance automatically when another is created

Hello I have a user model and a ratings model. Whenever a new user is created I want to create a new feedback model with it automatically. Each user model has one feedback model and each feedback model has many ratings. My Classes class User < ActiveRecord::Base end class Feedback < ActiveRecord::Base belongs_to :user has_many ...

Handling dynamic data from javascript or rails

I have page consisting of a calendar view ( http://code.google.com/p/calendardateselect/ ) as well as divs, each of which contain information about a person. In each div I want to have a link to a new controller and action, and pass the id for the person and the date selected in the calendar. I can think of a one way, but I'm thinking t...

Autocomplete Error Question - Ruby on Rails

I have built a very simple blog application using Ruby on Rails. New to both Ruby and Rails so excuse the stupid questions. I currently have two tables that relate to this question. I have a Post table and a Tag table. Basically I set it up such that Post has_many :tags and Tag belongs_to :post. I am using AJAX to process and display t...

Adding RESTful route to Rails app

I'm reading these two pages resources Adding more RESTful actions The Rails Guides page shows map.resources :photos, :new => { :upload => :post } And its corresponding URL /photos/upload This looks wonderful. My routes.rb shows this map.resources :users, :new => { :signup => :get, :register => :post } When I do: [~/my_app...

How do a search a table for similar records and displaying count - Ruby on Rails

I have created a table in my Ruby on Rails application that I am building called Tags. It is a blog application so I allow the user to associate tags with a post and do this through a :posts, :has_many => tags and Tag belongs_to :post association. Now that I have my Tags table I am trying to see how I would render the view such that it...

ruby rails loop causes server freeze

Hi all: I am working on a Ruby on Rails project on Windows. I have Ruby 1.86 and Rails 2.35 installed. Everything is fine until I tried to implement a comet process. I have the following code written to respond to a long poll javascript request. But everytime this function is called, it will hang the whole rails server, no second reques...

juggernaut error

i am trying to experiment with Juggernaut plugin using chat_sandbox example. i get this error message Juggernaut: There has been an error connecting on 127.0.0.1:5001 I have no idea what it means. my juggernaut.yml is as follows :hosts: - :port: 5001 :host: 127.0.0.1 :public_host: 127.0.0.1 :public_port: 5001 # :s...

How do I utilize REST to post GPS data from an Android device into a Ruby on Rails application?

I am a student in the process a building an Android app that can post a GPS track into a Rails application. I would like to do things the "Rails" way and take advantage of the REST. My rails application basically has 3 models at this point: users, tracks, and points. A user has_many tracks and a track has_many points. A track also ha...

in ruby on rails, how to call a action in ApplicationController?

I am new to Ruby and RoR. I am not really understand how the controllers work. I have an action in ApplicationController def some_checking ... end And I would like to call the action some_checking in another controller class OtherController < ApplicationController some_checking def xxx end end Is there anything wrong? H...

Rails submit_to_remote can't POST

I'm trying to nest a form within another using submit_to_remote but it does a PUT instead of a POST. Can anyone explain what's wrong here? The routes are RESTful: map.resources :thing map.resources :item The view is like this: <% form_for(@thing) do |f| %> <% fields_for(Item.new) do |i| %> <%= i.text_field :name %> <%= sub...

Preventing Rails from opening production.log, when it is deployed with jruby-rack into tomcat.

I have to to deploy a Ruby on Rails application to an tomcat application server using jruby-rack. Due to security reasons my customer has the webapps directory mounted read only and he won't changed this. The problem that arises is, that the rails logger wants to open the WEB-INF/log/production.log in write mode. He writes nothing to thi...

Rails: periodically use HEAD to check for page changes

I have a Rails app implementing a game, so it's expected that a player will leave a browser open at the game page. When player Alan takes an action himself, I use AJAX requests to update the game page Alan is viewing to reflect the new state. However, when another player (Bob) takes an action, I don't have (or want) a mechanism to push t...

Is it possible to route heroku-rails-app to a subdirectory of my custom domain?

I want to setup a rails app on heroku that is part of a website. The website which is hosted on a different server explains the usage of the app, shows a tour, plans, contains a blog on related stuff and so on. I want to route to my_domain/app and the app should respond to that url. The custom_domain add-on doesnt allow to enter directo...

Mac text editor for Ruby on Rails

My text editor of choice for PHP work is Panic's Coda. But for Ruby on Rails, its autocomplete feature is continuously in my way and ROR's standardization on 2 space tabs does not play well with Coda's settings. I've been going back to TextMate for ROR work, but was wondering if there were better options. ...

Highlighting the link_to_remote link

Hi i have the rails application. when i call the home controller i have index action . in the index.html.erb .i have some link_to_remote links. <li><%=link_to_remote "Example", :update =>'view', :url =>{:controller => 'home',:action => 'bank'}, :method => :post, :html =>{:id =>"cb"}, :with => "'choose=' +encodeURIComponent('...

Accessing Current URL using Prototype

Hi folks, following Ryan Bates Screencast #114 I'm trying to generate endless pages using prototype. In difference to Ryan's showcase my URL called via the AJAX request shall be handled dynamically, cause I do not always call the same URL when the user reaches the end of my page. So my JS running in backround looks like that and uses...

Problem with heroku db:pull while at work.

When I try to pull down a database while at work I get the following error: :>heroku db:pull Auto-detected local database: sqlite://db/development.sqlite3 Bad credentials given for http://heroku:[hidden]@taps.heroku.com Note that when I am at home I am able to run this command just fine. I wanted to know if you have any suggestion...

Rails Testing System Stack Error

I resumed testing my rails app after suspending it. Running tests on my rails app returns a SystemStackError now. Even a simple test like def test_per_page assert_instance_of Fixnum, Activity.per_page end is giving me C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/m odule/introspection.rb:74:in `loc...