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 ...
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...
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 ...
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...
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...
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?
...
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 ...
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'...
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...
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.
...
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?
...
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...
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...
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(...
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...
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.
...
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...
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 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?
...