ruby-on-rails

How do I attach an inline image to the email being sent by ActionMailer?

How do I attach an inline image to the email being sent by ActionMailer? How do I test if image was really attached at a specific place in the Email? ...

Rails: radio button selection for nested forms objects

I have the following form for photo_album which uses the nested forms feature of the Rails in saving the photos while updating the photo_album. And having trouble with the selection of radio button value. I want only one of the photos be able to select as the album cover, but due to the way rails produces form element ids and names, I am...

Rails: when would one use shopping cart software when developing a webstore with rails?

For someone who would like to develop a webstore type web application, and at the same time learn about web development with rails, would you recommend using a shopping cart service or starting from scratch? I guess I'm not entirely sure exactly what shopping cart software is either, so if someone could elucidate this and explain why som...

Passenger / REE can't find rails, it's in the $PATH, what gives?

I've got a fresh install of Ruby EE (1.8.6-20090610) and Passenger (2.2.5) on Debian Lenny. REE is installed in /opt/ruby-enterprise and it is added to the $PATH of all users through /etc/environment, and PassengerDefaultUser is set to root. The problem is when loading a rails app, the Passenger error says the rails 2.3.3 gem is missin...

How do you use errors.add_to_base outside of the validates_ or validate_ model methods?

I have a Course class that has many WeightingScales and I am trying to get the WeightingScales validation to propagate through the system. The short of the problem is that the following code works except for the fact that the errors.add_to_base() call doesn't do anything (that I can see). The Course object saves just fine and the Weigh...

Why does Postgresql fail with Geokit like this??

I've just started playing with geokit with Rails for an app I am building. I have got my recorda getting geocoded, but then when I go into the console to have a look at what I can do it with and it blew up with the following: user is a user object with lat and lng from my database >> Restaurant.find(:all, :origin => user) Restau...

Ruby on rails: Render 2 partials or figure out the kind of class and object is...

I want to display different types of objects in the same ajax called controller function. I want to render out when I send back an ajax call. The problem is I want the "title" attribute of one object and the "name" attribute of another object. I can't render 2 partials and can seem to figure out how to check the type of object an object ...

rails built in datetime validation

Does rails do any validation for datetime? I found a plugin http://github.com/adzap/validates_timeliness/tree/master, but it seems like something that should come in out of the box. ...

Build a Form Builder with Ruby and JQuery

I'm looking for some advice on designing the above for a RoR application that basically has two sections: 1) Admin Form Builder 2) End User Form (that was created by the admin in step 1) I've prototyped the JQuery form (end result) I want and it uses "progressive disclosure" (similar to Yehuda Katz's Bamboo example in the JQuery in Ac...

Twitter gem for rails always fails on first status update (console example included)

Every time I try to post to twitter in my rails app, the first post fails. I will explain the issue further after I show a quick example. Here is a live example from the console (with sensitive stuff edited): >> u = User.find(7) => #<User id: 7, login: "[email protected]", email: "[email protected]", crypted_password: "stuff", sa...

Collection_select problem

UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from BushyMark. I think I made all the suggested changes correctly, but I still can't get the post_type_id to save to the database when a user submits a message. My app has a profile page. On the profile page, the owner of the page can type an update and...

resource_controller get rid of setting flash notice?

I am talking about rails resource_controller gem plugin here: Basically when I am doing json format, I would like to completely suppress the flash notice if possible, trying to call flash "" will fail, while calling flash[:notice]="" doesn't look really nice either. Is there some better approach? ...

How to reload partial pages in Rails using RJS ?

Hi Currently i am working on a rails project . where i have to reload a partial page . For example Create action def create # Some transaction to the database respond_to do |format| format.html {render :text => 'Add post' } format.js end end In my views posts/create.js.rjs i would like to reload the users/...

New controler method requires ID in the parameters hash

I have created a new method in one of the project's controllers that it will allow the users to search using SearchLogic's gem. The method is called search_entries and it is of course accompanied by a corresponding view. But when I hit the "Submit" button Rails complains that "Couldn't find Entry with ID=search_entries" (where Entry is ...

How to render all records from a nested set into a real html tree

I'm using the awesome_nested_set plugin in my Rails project. I have two models that look like this (simplified): class Customer < ActiveRecord::Base has_many :categories end class Category < ActiveRecord::Base belongs_to :customer # Columns in the categories table: lft, rgt and parent_id acts_as_nested_set :scope => :customer_...

Gem Server and Rails RDoc Not Found

I would like to read Rails documentation locally though gem server. I go to http://localhost:8808/ and Rails 2.3.3 gem is in the list of the gems installed, but when I click [rdoc] I get: `/doc_root/rails-2.3.3/rdoc/index.html' not found. I tried to uninstall and reinstall Rails but I got no effect. All other gems work properly, why ...

How to change validates_numericality_of into validate on rails

How do I change validates_numericality_of :test, :greater_than_or_equal_to=>0 into validate form I tried only character and nil values. I need to check also it must be greater than 0 validate change_test def change_test if @test.nil? errors.add_to_base('Hi Test should be only number') end end and also I tried like this, ...

Aliasing activerecord methods inside plugin

I'm trying to write a plugin that aliases some methods in ActiveRecord in the following fashion: class Foo < ActiveRecord::Base include MyOwnPlugin acts_as_my_own_plugin :methods => [:bar] def bar puts 'do something' end end Inside the plugin: module MyOwnPlugin def self.included(base) base.class_eval do ...

Rails App Notification Plugins

Hi Can anyone recommend some rails plugins that would allow me to register various notification against models that could be linked to a set of templates to format emails (and possibly other). Ideally the plugin could be referenced in one line from each model and the notification format could be passes from some construct such as user...

Snow Leopard, sqlite3-ruby

So I followed every suggestion in this thread without success. I'm running os x 10.6, rails 2.3.3, ruby 1.9.1 and still getting this error when I try accessing the front page of my rails app: uninitialized constant SQLite3::Driver::Native::Driver::API I've googled every possible combination of snow leopard, rails, sqlite3 without any...