ruby-on-rails

Can the submission of a rails form avoid navigating away from the current view?

I have a bit of javascript magic going on to create and hide divs on the fly as the user interacts with the page. Each div contains a view of some part of my application and each model instance in these views has an owner. If the person browsing the page is NOT the owner, they just see the data. However, if the user is the owner of th...

Routes.rb creating problem in rails

Hi Im using a link which is <%= link_to 'View User Group', {:controller=>:communities,:action=>:usergroups} , :class => "adminbutton viewusergrp" %> and routes contain the map.resources :vccommunities,:member => {:usergroups => :get} and some more action names are also specified here in member and collection. Im taking care of alphab...

Rails non-table drop down list

I need to have a drop down list in which the user selects the day of the week they want to come in every week. The values will never change right. It's just Sunday, Monday, ..., Saturday right? It seems like more work than needed to make a table and put the days of the week in. I certainly don't need the ability to create, update or de...

how to access rails join model attributes when using has_many :through

I have a data model something like this: class CollectionItem < ActiveRecord::Base # the collection_items table has columns collection_item_id, collection_id, item_id, position, etc self.primary_key = 'collection_item_id' belongs_to :collection belongs_to :item end class Item < ActiveRecord::Base has_many :collection_items ...

What is causing this ActiveRecord::ReadOnlyRecord error?

This follows this prior question, which was answered. I actually discovered I could remove a join from that query, so now the working query is start_cards = DeckCard.find :all, :joins => [:card], :conditions => ["deck_cards.deck_id = ? and cards.start_card = ?", @game.deck.id, true] This appears to work. However, when I try to move th...

MemCacheError: execution expired

I'm using the awesome cache-money gem with a large rails project. I frequently get these exceptions MemCache::MemCacheError: execution expired" There doesn't seem to be a rhyme nor reason. What exactly does this mean, and how to fix? EDIT: Here is a representative stack trace: lib/authenticated_system.rb:100:in `login_from_...

Is It worth learning Ruby On Rails

Is Ruby On Rails a growing Framework, or will it die in the next few years? Is it worth committing your project to it now? ...

Rails Restful Authentication : Can't find UserObserver

I am moderately new to Rails so this may be a stupid question... I followed the basic steps noted on the github site for the plugin (mainly installed the plugin, ran the generator, modified environment.rb and created the UserObserver class in the models directory) The error I'm getting is saying it's coming from active_support/dependen...

Can I interact with Rails models within a Capistrano task?

I often used Rake tasks that are dependent upon the Rails environment task having loaded. I then interact with Rails Models within the Rake tasks. Can I do this in Capistrano? ...

Ruby: In unix find if user who executed the program is root

Hi, I'm writing a rake script and would like to detect (using Ruby rather than bash if possible) if the user who executed the rake script has root privileges. If it is not root then I would like to terminate the script. Regards, Chris ...

Reusing Code from Another Rails App

I am trying to reuse some code from another rails application I had worked on earlier. I copied over all the models / views / controller / migrations and ran rake db:create and migrate. Now when I try to run the application the initial page for this view (the one that has the list edit/delete) loads fine and shows there are 0 records. Wh...

Eager loading last subordinate record

Suppose that model X has_many Ys and model Y belongs_to X. Each Y has a date when it has been inserted to the database. Now, is it possible to load all Xs and eager load last Y for each of X (only the last because each X has bazzilions of Ys)? ...

Howto: "users who have visited your profile..."

I would like to show each user who has visited her/his user profile. At first it looked easy as the acts-as-readable plugin does everything I need. However this plugin does not work from the user model. What if in the future I decided to add visitors to articles, albums etc. /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ac...

Ruby on Rails deployment requirements

I have started to think in RoR as an option to develop my applications, but I don't know much about it. I usually deploy my applications to Windows XP or Vista based PCs and use SQL Server as database. Which are the system requirements to develop a Ruby on Rails application? ...

Fixtures and Selenium and Rails (oh my?)

What data do you use with Selenium tests on Rails apps? Do you load from fixtures? Use an existing dev db? Use a separate (non-fixture) db? I'm considering my options here. I have a Rails app with a large Selenium test suite that runs on a modified version of Selenium Grid. Part of the process, right now, is loading a large set of fixt...

How do you make a case for Django [or Ruby on Rails] to non-technical clients.

Businessmen typically want a web application developed. They are aware of .net or J2EE by names, without much knowledge about either. Altho' Rails and Django offer for a much better and faster development stack, it is a big task to convince businessmen to use these platforms. The task begins with introducing Django (or Rails), quoting ...

ActiveRecord::StatementInvalid: Could not find table 'tablename'

cis.statbib.org: script/console Loading development environment (Rails 2.2.2) Article.founc>> Article.count() ActiveRecord::StatementInvalid: Could not find table 'article' from /home/hadley/web/cis.statbib.org/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure' from /home/h...

Find the associations for an ActiveRecord class at run-time?

I would like to find the assocations of an ActiveRecord class at runtime... Let's assume I have the following: class Person < ActiveRecord::Base has_many :chairs has_many :pens end class Chair < ActiveRecord::Base belongs_to :person end class Pen < ActiveRecord::Base belongs_to :person end How can I find out at runtime that...

How do you deploy a Ruby on Rails application on hostgator?

How do you deploy a Ruby on Rails application on hostgator? ...

Ruby on Rails Single Table Inheritance (STI) and unit test problem (with PostgreSQL)

I'm using an STI model with a single "Accounts" table to hold information for Users and Technicians (i.e. User < Account, Technician < Account). Everything works from a functional perspective, but things explode when running unit tests: ... 8) Error: test_the_truth(UserTest): ActiveRecord::StatementInvalid: PGError: ERROR: relation "t...