similar to: Compact db design a bad idea?

Displaying 20 results from an estimated 2000 matches similar to: "Compact db design a bad idea?"

2006 Sep 03
7
using polymorphic associations with acts_as_list
This is what I have class Photo < ActiveRecord::Base belongs_to :image, :polymorphic => true acts_as_list :scope => image end class Place < ActiveRecord::Base has_many :photos, :as => :image end class Child < ActiveRecord::Base has_many :photos, :as => :image end I want to be able to reorder the images. What I need is for the position of the photos to be set
2012 Jul 18
0
Rails 3.1 Optional Routes
Hi all, I am using Rails 3.1 and Ruby 1.9.2 In my application i am using optional routes like below match ''Gallery(/:gallery_id(/:image_id))(/page/:g_page)'' => "wps/ gallery#show_gallery_page",:as => :gallery_page in console i am trying to call the routes like below include Rails.application.routes.url_helpers => Object 1.9.3dev :002 > gallery_page_path
2010 Sep 08
2
subbing a string vector for another string vector
I have a data frame with two columns: image pattern 1 http://$IMAGE_ID$ www.url.com/image.jpg 2 $IMAGE_ID$ http://www.blah.com/image.gif ... I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern column such that the result would appear as follows: url http://www.url.com/image.jpg
2006 May 14
4
searching on foreing keys
Hey all, I''m using a simple search function. It''s working great except for foreign keys. I have one table pets (id,name,owner_id) and another table people(id,name) owner_id being a foreign key of pet pointing to people name. here it is on the pet controller: @paginator, @pets= paginate(:pets, :conditions =>["name OR owner_id like
2006 Mar 20
1
FileColumn question
Can someone please help me with this. I have an Images table :- create table images ( id integer unsigned not null auto_increment primary key, image varchar(200) not null default '''' )ENGINE=InnoDB default CHARSET=latin1; And a car table :- create table cars ( id integer unsigned not null auto_increment primary key, user_id integer unsigned not null, title varchar(100) not
2008 Jul 08
4
Conditional "link_to" helper function - AYUDAME POR FAVOR
Hello, I need to write a function that will return a link only if the current user is the owner. Here is my code... 1. application_helper.rb 2. 3. def link_to_if_owned(owner_id, anchor_text, where_to_go) 4. if current_user.id == owner_id # current user is owner 5. "#{link_to anchor_text, where_to_go}" 6. else 7. anchor 8. end 9. end And
2007 Feb 25
1
Relationships question (?)
Hello there, Im currently taking a Senior Design Course at my college. We are developing an online document editor prototype with Rails. I am not well-versed in Rails. As a matter of fact, we chose it for the project in order to learn it. The problem we have is the following: We have a User model (id, username, password, email) and we have a Document model (id, name, content, owner_id). A
2010 Sep 01
0
Error on update_attributes with HABTM relationship
Hope someone can tell me what''s up, because this has me baffled. I have an Image model, and a Provider model. Both are defined as "has_and_belongs_to_many" relating to each other. In my image form partial, I have a bit of AJAX generating the provider_ids array dynamically from a provider AJAX search on the same page. So for example, each time I click on a provider name that
2005 Mar 08
1
Adding to model (newbie)
Sorry if this is a really lame question, I''m sure it''s something fairly obvious, but I just can''t see it at the moment... I''m trying to add something simple to the model for a project management/todo list/thing. The DB has ''first_name'' and ''last_name'', and I''d like to have "full_name" available. So -
2006 Jul 17
6
3 newbie questions
hey all, I have 3 tables like this: Images (id,name) Tags (id,name) ImagesTags(imageid,tagid) in my image model I do a "has_and_belongs_to_many :tags" but to make it work I need to rename ImagesTags(imageid,tagid) to Images_Tags(image_id,tag_id). My question is that given that I can''t rename the table, is there any way to make it work with the original names? Second question:
2007 Aug 17
0
map.with_options :path_prefix => ''
Hello, I am getting a ''No route matches'' error in rspec with routes that have a path_prefix composed by map.with_options. Rails recognizes the routes just fine and the site works, but I can''t get the specs to pass unless I put the prefix in each individual route. Any help is appreciated. My foo model has a polymorphic owner which is what I want the path_prefix to
2006 Nov 04
0
[Markaby] select with acts_as_dropdown problem.
I''m using Markby to convert a standard form witth selects. Can someone tell me why this works: <tr> <td><label class="formLabel" for="task_owner_id">Owner</label></td> <td><%= select ''task'', ''owner_id'', Owner.to_dropdown %></td> </tr> But, the Markaby conversion
2006 May 29
0
using components to reuse code
the following is the code of the controller, under the dir components/test/: class Test::GroupsManController < ApplicationController uses_component_template_root def add_to_group @account = Account.find_by_nick(@params[:nick]) # render :text => "#{session[:account_id]} #{Group.find(session[:group_id]).owner_id}" if (session[:account_id] ==
2006 Mar 22
1
How do you clean up this cryptic code?
So, I''m coding my school project in Rails. There are two models, User and Restaurants. I noticed that in Restaurants, when you use the belongs_to method, you could specify the condition of the associated table. There are a few types of users, in the user_type column of the users table - owners is type 1, users are type 2. So in my haste to hand in enough code, in the Restaurant model,
2008 Jan 10
0
BUG? has_many :through makes funny queries
So I have this structure. class Gallery < ActiveRecord::Base belongs_to :owner, :polymorphic => true has_many :folders, :order => ''slug'', :dependent => :destroy class Folder < ActiveRecord::Base has_many :photos, :dependent => :destroy, :conditions => "parent_id IS NULL" belongs_to :gallery class User < ActiveRecord::Base has_one
2006 Apr 22
9
one to many question
1. A category has parent categories. 2. A product is in many categories and a category has many products. 3. Products and category both have images in the same image table. ie. a product and / or category could have multiple images.<=== my question is related to this So among other things I presume I have to do the following: class Category < ActiveRecord:Base #...
2008 Jan 22
1
getting multiple select to work: options_for_select
Hi, <%= select_tag ''image_id'', options_for_select(Image.find(:all) {| an_image| [ an_image.name, an_image.id ] }), :multiple => true %></p> * I am in a view, and I am trying to search the image table and make a multiple select box with each image''s name. * Right now it is working, but I see this: ---------------------------------------------
2008 Jun 13
6
Newbie question on has_many
I have two classes: a Widget and a User. The User has an id that is referenced in two places on the Widget: owner_id and operator_id. How should I structure that reference for has_many? Thanks folks - I appreciate any help on this. --David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2013 Oct 16
9
puppetdb, foreman, one particular node has a problem
I have about 75 nodes now and recently added 6 of them. They are all running Debian squeeze and all have exactly the same Puppet packages. One is giving an error when I try to enroll it: Failed to import facts: PG::UndefinedColumn: ERROR: column "environment" of relation "hosts" does not exist LINE 1: ...d", "created_at", "disk",
2006 Apr 30
3
require "ajax_scaffold" in model error
Hi there, I''ve got installed ajax_scaffold_generator (3.1.2, 2.2.1) Anyway I''m following the example here <http://height1percent.com/ articles/2006/04/18/ajaxscaffold-3-1-0-released> which suggests the following in a model file: -------------------------------------------------------- require ''ajax_scaffold'' class Pet < ActiveRecord::Base