Ok I need some expert advise here....
I have a Photo Album that has_many Photos... Common stuff right?
Where I need expert advise is I want the use to click the desired photo album... and then see one photo at a time...
Should that all be happening in the PhotoAlbum Controller? that's how I have it now but it's getting messy as I want...
I'm using paperclip in my rails 3 app to upload photos, resize with ImageMagick and then post to S3.
For the life of me, I can't figure out why this process is soooo slow on my localhost? Even without any resizing it's crazy slow... 30+ seconds for one photo?
And my network & cpu aren't even working hard?
Why?
Updating with Model:
c...
2 models
Books (has_many: chapters)
Chapters (belongs_to: books)
Id like to display a list of books, but only books with chapters.
Here's what I have so far:
@books = Book.find(:all,:include => :chapters)
Problem here is that books is returning books w/o chapters (0 chapters)
when dealing with nested resources like this, how do I ...
I have a ruby (on rails) class:
class User < ActiveRecord::Base
# relationships
belongs_to :current_shipping_address, :class_name => "Address"
belongs_to :subscription
# Validators
validates_presence_of :subscription
validates_presence_of :current_shipping_address
end
I do this in a controller:
subscription = Subscriptio...
hi All,
Preface:
If you hang out in #rubyonrails on freenode this may sound like an echo to you as i asked it in there 2 days ago. After spending a number of hours researching AR associations, following my discussions in #rubyonrails, i still feel lost so I'm asking here. :)
Goal
I host a number of blogs. My intent is to create ba...
I downloaded an archive containing code for a Rails application ( from a book I'm reading ). I'm running Rails 3.0.1 but the application fails to start, because it's looking for 3.0.0beta3. Is there some way of starting it with my version of Rails?
...
I have a model called Company, and in the Show view have the following:
<div id = 'tags'>
<strong>Tags:</strong>
<% unless @company.tag_list.empty? %>
<%= @company.tag_list %>
<% end %>
<% form_remote_tag(:url => {:action => 'update'},
:update => 'tags') do %>
<%= text_field :company, :tag_list %> ...
Hello,
I have the following two models:
class Project < ActiveRecord::Base
has_many :photoalbums
end
class PhotoAlbum < ActiveRecord::Base
belongs_to :space
end
routes.rb:
resources :projects do
resources :photo_albums
end
What I'm trying to do in the Controller is get a list of all the project's photoalbums:
class PhotoAl...
Hello,
I'd like my model's has_attached_file setting for paperclip to have a path as follows:
:path => "/:attachment/:instance_id/:id/:style/:basename.:extension",
so I setup a Paperclip.interpolates to obtain (:instance_id)
Paperclip.interpolates :instance_id do |attachment, style|
def user_id(attachment, style)
attachment.c...
Hi,
I started using bundler and have some problems getting it working. I have the following gemfile:
source "http://rubygems.org"
gem "rack", "~>1.1"
gem 'pg','>= 0.8.0'
gem 'rails','2.3.8'
gem 'authlogic','2.1.3'
gem 'ajaxful_rating','2.2.3'
gem 'will_paginate','2.3.12'
gem 'right_aws','1.10.0'
gem 'aws-s3','0.6.2'
gem 'declarative_au...
I think I understand it as, if it is Rails 2.x
config.gem 'gem_name' # in config/environment.rb, and then rake gems:install
and in Rails 3.x
gem 'gem_name' # in Gemfile, and then bundle install
these are the two standard ways to add a gem into a Rails project.
Is there a standard way to add a plugin? It seems that it u...
Hi,
Running in a Linode slice with Ubuntu 10.04 LTS. I am getting a 500 Internal Server Error.
The Apache log has:
Apache/2.2.14 (Ubuntu) Phusion_Passenger/2.2.7 configured -- resuming normal operations
caught SIGTERM, shutting down
* Passenger could not be initialized because of this error: The Passenger spawn server script, '/usr/...
How to implement in rails a category that can be child of another category (self-referential has_one) ?
Thanks
...
Hello,
I'm still on the hunt for an elegant multi-file upload for Rails.
I just learned about the "input type=”file” multiple"
Does Rails support this? Any examples? tips on how to implement for uploading multiple photos to a photoalbum model in Rails?
Thanks
...
I already gem bundler in system. I check "gem list". it show:
*** LOCAL GEMS ***
bundler (1.0.3)
but I go to app and execute "bundle install". it is show:
bundle: command not found
please help me.
...
My App has two UI states:
- Signed IN
- Signed Out
I've been using the following to determine which app/view/layout to use based on if the user is signed in or out with Devise:
# Devise, way of using a different Layout for all the devise/non-signed in Views
layout :layout_by_resource
def layout_by_resource
if devise_control...
Trying to test a controller in Rspec. (Rails 2.3.8, Ruby 1.8.7, Rspec 1.3.1, Rspec-Rails 1.3.3)
I'm trying to post a create but I get this error message:
ActiveRecord::AssociationTypeMismatch in 'ProjectsController with appropriate parameters while logged in: should create project'
User(#2171994580) expected, got TrueClass(#214825...
I'm using Rails 3.0.1, HAML 0.3.22, and Mongrel 1.1.5 (and MongoMapper not AR). I'm rendering a list, and each list item is it's own partial. Every time the page renders one of the list item partials takes almost 100X longer to render (and it is an arbitrarily different one each time. Also, needless to say, each item has essentially the ...
I'm having a weird problem, hoping someone knows what the issue is...
Using distance_of_time_in_words (and consequently time_ago_in_words) is not returning the actual time distance. Instead it is returning things like "en, about_x_hours" or "en, x_minutes".
The pattern is correct, as in:
time_ago_in_words(50.minutes.ago) => "en, about...
I'm going to start with the usual noob line, "I'm new to rails". Oh, and I'm running Mac OSX 10.6.4
I've been following a bunch of guides to get set up, specifically these two here and here. The guides are great, the reason I'm using the second one is because of RVM and the reason I'm using the first is for MYSQL.
Anyway, when I star...