I appologise in advance for the length of this post....
I'm developing a rais app that uses paperclip to store stuff on Amazon S3.
The app is hosted on Heroku.
I'm developing on Ubuntu Karmic.
The problem that I am about to describe occurs in development (on my localhost) and production (on Heroku).
The standard way of passing S3 cr...
I have trouble with the self referential association, the models should give ma an array of models for the left_chunks and right_chunks methods, but I get everytime an empty array
The source
class Chunk < ActiveRecord::Base
has_many :left_bindings, :foreign_key => "left_chunk_id",
:class_name => "ChunkChunk",
:dependent => :des...
I have a rails application running under 2.3.4 and Ubuntu. I'm using passenger.
I have had complaints when users try to upload large files (>300MB). For my part, I can do it just fine, but I have a very fast internet connection.
What's more puzzling is the behavior they see on their end. At some point into the process the upload proces...
I developed a ROR application using MySQL and now want it to use Postgres instead.
I've used Navicat to data transfer the MySQL database to Postgres, and updated the database.yml with the Postgres environment settings.
When I run the ROR application, and try and login or create a user, I get the following error:
RuntimeError: ERROR...
I tried following the example at:
http://www.plupload.com/example_custom.php
But in the request, file is not sent to the method of the controller, only the name.
Maybe I need to set in the configuration of Plupload, something like 'multipart = true'
Any idea?
...
I've got an Order and Orderdetails
Orderdetails belongs_to Order
Order has_many Orderdetails
I am trying to convert the following query to ActiveRecord count function
select Count(*)
from orderdetails A, orders B
where A.prodid='6' and A.orderid= B.id and B.custid='11'
I tried:
@count = Orderdetail.count(:conditions => "prodid ...
Suppose we have a photography site. Any author can subscribe to receive updates from any other author. Obviously if author A is subscribed to author B that doesn't mean that B is subscribed to A. So we build models
class Author < ActiveRecord::Base
has_many :subscriptions
has_many :subscribed_by_author, :through => :subscriptions, :...
I have a singular nested resource like so:
map.resources :bookings, :member => { :rate => :post } do |booking|
booking.resource :review
end
Giving me these routes:
new_booking_review GET /bookings/:booking_id/review/new(.:format) {:controller=>"reviews", :action=>"new"}
edit_booking_review GET /bookings/:booki...
When running
heroku db:push
I'm getting the following error returned
Sending indexes
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:188:in `log': RuntimeError: ERROR C42P01 Mrelation "serviceavailability" does not exist P245 Fnamespace.c L276 RRangeVarGetRelid: ......
Hi, i need to render a complex xml, that may looks like this:
<container attr1="" attr2="">
<user login="" />
<product name="" version="" />
<anotherTag />
</container>
user and product are the model-objects. container's attributes has values, not related to models, anotherTag has some another information, also not related...
Hi,
I have products, productinfos and infos with categories
In my Info model I have a
named_scope :general
Which gets all records that belong to the category with the name general.
Then in my view I have a loop going through all categories
lets say I then have
asset = 'general'
now I would like to do
@generalinfos = @product....
I have been a user of Rails for a while and used version 2.3.4 recently.
Rails 3 Beta just came out recently and it seems have significant performance improvement especially with the merge with Merb.
I'm planning on building an application that will take 4-6 months. Should I use Rails 3 for it starting with beta? Knowing that it will b...
I have a User model that acts_as_authentic for AuthLogic's password management. AuthLogic adds "password" and "password_confirmation" attributes over top of the db-backed "crypted_password" attribute. This is pretty standard AuthLogic stuff.
I want to have a method that sets both password and password_confirmation at the same time (usef...
Good day,
I have been using Rails/Mysql for the past while but I have been hearing about Cassandra, MongoDB, CouchDB and other document-store DB/Non-relational databases. I'm planning to explore them later as they might be better alternative for scalability.
I'm planning to start an application soon. Will it make a different with Rail...
I'm trying my first application with mongodb on Rails using mongo_mapper and I'm weighing my options on an STI model like below.
It works fine, and I will of course add to this in more ways than I can currently count, I just curious if I wouldn't be better off with Embedded Documents or some such.
I'd like my models to share as much as...
I have a pattern in a couple of templates that's repeated. The code is for rendering a set of tabs and content for each tab.
Contents of /app/views/general/_product_groupings.html.erb
<table cellpadding="1" cellspacing="0" class="sub_container clear">
<tr>
<% first_visible_tab = true %>
<% @bundle.groupings.each do |group| %...
I have an album which has_many photos. A counter_cache setup updates the photos_count column in the album table. How do I limit the number of photos for an album?
...
Hey guys I've been using the has_and_belongs_to_many relationship with checkboxes example from the Railscast Episode #17 . I had some problems and now everything is working kind of smoothly except the update button will not work.
the edit view looks like so
<% form_for :users, :action => 'update' do |f| %>
<% for interest in Intere...
I am trying to show concatenated information in the drop downs text.
This is what I have:
<%=collection_select(:product, 'prod_name', @prods, :id,
"#{:category.name - :prod_name}", {:prompt => 'Select Product'})%>
Product belongs_to category.
So i can do the following which works fine:
@p = Product.all
@p.first.prod_name
@p.firs...
Given the following resource definition:
map.resources :posts, :except => [:show]
map.post '/:year/:month/:slug, :controller => :posts, :action => :show
I can make url_for work for me, using this syntax:
<%= link_to @post.title, post_url(:year => '2010', :month => '02', :slug => 'test') %>
But is there a way to make this work?
<%=...