ruby-on-rails

undefined method `reduce'

So in my local app, everything is fine. Both are running Ruby 1.8.7, and Rails 2.3.5, however my deployed app gets the following error. ActionView::TemplateError (undefined method `reduce' for #<Class:0x7fbbd034d760>) The only difference that I can think of is the OS, I'm working on OS X and deploying to Linux. That can't really be ...

css files not loading after capistrano deploy

Hey Guys, I have noticed that after I do a deploy via capistrano, the static css files dont seem to be loading, this is true when I specially specify <%= stylesheet_link_tag 'resume',:cache => true %> removing the :cache => true solves the problem, but I would like to know why that option is causing a problem in the first case, and s...

Ruby on Rails passing of parameters between views from link_to tag instead of submit_tags (having both on page)

Hi, I'm creating in my index page of my ruby on rails program, a list of the most commonly searched for terms in my database and hence each time a user selects a specific category this is written to another database. What i would like it to create a hyperlink and pass a certain amount of parameters to a form like is usually done with a ...

creating a controller in Rails

I'm trying to use the generate script to create a controller. I run the following command: > ruby script/generate controller Greeting and the controller seems to be generated no problem. Then I add a method called index to the GreetingController: class GreetingController < ApplicationController def index render :text => "<h1>We...

New iMac - New Rails Environment - Dropbox - Permission Problem...

Ok, I just bought the new 27 inch iMac and I am trying get everything set up. I am new to rails and have been developing on my MacBook Pro and seem to be having some trouble sharing my applications. I use dropbox which allowed me to easily access the new files from my new iMac and therefore my rails applications but after installing rail...

Add image to layout in ruby on rails

I would like to add an image in my template for my ruby on rails project where i currenly have the code <img src="../../../public/images/rss.jpg" alt="rss feed" /> in a the layout stores.html.erb file however this doesn't seem to load as it looks like its missing a route which i'm not sure what its supposed to be. Any ideas please? ...

Bypassing rack version error using Rails 2.3.5

I'm currently on Dreamhost attempting to run a Rails 2.3.5 app. Here is the situation, Dreamhost's servers have Rails 2.2.2 installed. Of course, I can't update a shared host's rails version, so I froze my Rails in vendor. Rails 2.3.5 requires the rack v1.0.1 gem. Dreamhost uses the rack v1.0.0 gem. So when I try to define: config.gem ...

How to display photos by rating with Ruby on Rails framework?

Ok. I've got a model Picture class Picture < ActiveRecord::Base has_one :rating has_many :comments end And, of course Rating model class Rating < ActiveRecord::Base belongs_to :picture end I made rating system by myself. So, now on the frontpage I need to display all photos by rating. Please, can u show me how to do that. I'...

Paperclip doesn't resize uploaded pictures

Hello, I using rails 2.3.4 and PaperClip gem as plugin (the latest git master). And, given the following code: class Banner < ActiveRecord::Base has_attached_file :picture, :url => "/banners/:id/:basename.:extension", :path => ":rails_root/public/banners/:id/:basename.:extension", :styl...

How do I make my generator discoverable by Rails?

When I'm creating a gem, how do I make the generator discoverable by Rails? I have a generators directory with my generator inside. I symlinked it from ~/.rails/generators and it worked fine, but when I install the gem, even though the generators directory is installed, Rails doesn't find it. ...

Serving multiple Rails applications through one ruby interpreter instance

Hi, Given that each Ruby-On-Rails application needs at least about 40MBs of memory, I was wondering if there is a way of running multiple rails-application instances (different ones) over one interpreter of Ruby so that all shared libraries (rmagick etc) are shared between different application instances, saving space. If that would b...

In rails, given the account and the password, how to abtain the MSN contact list?

In rails, given the account and the password, how to abtain the MSN contact list? ...

DataMapper has n through Resource DELETE (Remove from association) not working

Hi, I'm have this two classes class User include DataMapper::Resource property :id, Serial property :name, String has n :posts, :through => Resource end class Post include DataMapper::Resource property :id, Serial property :title, String property :body, Text has n :users, :through => Resource end So onc...

undefined method `stringify_keys!' ruby on rails

Hi I have this code: def addcar @car = Car.new(params[:car]) render :action => "list" end <%(@allcars).each do |cell|%> <p><%= link_to cell.to_s, :controller => "car", :action => "addcar", :car => cell.to_s %></p> <%end %> and its giving me this error: undefined method `stringify_keys!' for "Honda":String I don't...

Can I use Struct.new as a Rails model? Or: How to create anonymous structured non-db backed sessions?

Given the following example: class AnonymousSession << Struct.new(:location, :preferences) def valid? ... end def new_record? ... end end While this interface is sufficient to create resourceful form and so on, it fails as soon as I want to save my form data to the session: if session[:user] = AnonymousSession.create(...

Rails: Specifing params without value to link_to

Supposing the route map.resources :articles how do you get this /articles?most_popular using link_to method? tried the following: link_to articles_path(:most_popular) # exception link_to articles_path(:most_popular => nil) # /articles link_to articles_path(:most_popular => true) # /articles?most_popular=true note: i'm using inh...

validation messages are not being displayed in rails.

Hi, I have added some validations in my model. for e.g. validates_presence_of :title,:message => "Please enter title" Now in the browser , validation is being done. But i cannot see any error message in the browser. ...

Best practice for structuring a 'large' Rails app

My question here is seeking best practice, general advice and insight, rather than a solution to a specific problem. I am in the early stages of planning out a Rails project which I consider fairly large. At its simplest level it offers a cookie-cutter CMS to the target users. So users sign up and choose a subdomain and are given a pret...

pass values from the view to the controller ruby on rails

Hi This is my controller: def addcar @car = Car.new(params[:car]) render :action => "list" end this is my view: <%(@allcars).each do |cell|%> <p><%= link_to cell.to_s, :controller => "car", :action => "addcar", :car => cell.to_s %></p> <%end %> In the link_to statement I want to pass cell.to_s to the controller. ...

How to disable caching in Rails?

How can I disable caching for my rails site? I'm running Passenger (mod_rails) and my site is running in 'development' mode: 'ENV['RAILS_ENV'] ||= 'development' Any help? ...