similar to: Magic Field Names - "position"

Displaying 20 results from an estimated 7000 matches similar to: "Magic Field Names - "position""

2006 Mar 31
5
Changing Table Schema and Models
If I make a change to a database table, how do I recreate the model to reflect the change? -- Posted via http://www.ruby-forum.com/.
2006 Jun 13
2
Magic field ''Status''
I can''t find any documentation on the ''status'' magic field. It''s listed on the MagicNumbers wiki entry, but not explained < http://wiki.rubyonrails.org/rails/pages/MagicFieldNames>. Is it reserved for later use? Thanks, Doug -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Mar 31
18
Modelling Foreign Keys
Can someone point me to a reference or tutorial that shows how to map foreign key relationships in the model? For example given: Users id name email Posts id user_id title How do I associate user_id with users.id in the Post and User models? has_many and belongs_to don''t seem to do it. -- Posted via http://www.ruby-forum.com/.
2008 Jan 04
5
Confused by the unit test results.
I''m testing the relation between two of my models: MessageThread (parent), which has_many Message (children). When I run the following test, it gives me an error: --------------------------------- # test with a valid message def test_valid_message_new thread = MessageThread.new :title => ''awesome thread'' message = thread.messages.build(:body
2006 Apr 04
2
Syntax Error in find()
Maybe I misunderstand the parameterization of find(), I am getting this syntax error for <% @choices = Choic e.find(:all, :conditions => "question_id" = question.id, :order => "order") %> ---- ERROR LOG ---- ActionView::TemplateError (compile error ../config/../app/views/admin/test/show.rhtml:37: syntax error _erbout.concat " "; @choices =
2006 May 18
3
Model Madness: habtm vs through
This has me scratching my head: a Person has many Things a Person has many Collections a Collection has many Things ...Things in a Collection are ordered ...Things in a Collection can be related to (created by) any User ...a collection has additional attributes, such as a name etc I am confused about habtm in rails (especially when using acts_as_habtm_list) vs. going the :through route.
2006 May 26
6
Help needed with acts_as_list
Hi ! There must be something I don''t understand clearly in acts_as_list I have a list of gallery entries (images + text), model is GalleryEntry. I have a field in_exhibition (boolean) I want the list to be sorted with a scope on in_exhibition : from 1 to N for every record having in_exhibition = false and 1 to N for every record having in_exhibition = true When I use acts_as_list
2007 May 22
3
can I use acts_as_list with a has_many :through association
I''d like to be able to use a has_many :through association and treat the associations as a list but I''m getting this error when I try an use an acts_as_list method: NoMethodError: undefined method `move_to_bottom'' I''m using edge rails r6786. Here are my domain rules: Activities are things students can do. Units consists of a sequenced list of
2006 Mar 22
10
Need for multiple acts_as_list
I have a model "Childmodel" that belongs_to two other models "Parent1" and "Parent2". "Parent1" "has_many :childmodels, :order => :positionp1" and "Parent2" "has_many :childmodels, :order => :positionp2". i.e. The child is independently positioned within each of its parents. This works fine and gets me the useful
2006 Mar 31
3
ID fields not getting picked up
For example I have table Questions. With fields id, text, and test_id. test_id is not being displayed in my view. I am hoping this means Rails has picked up that it is an id for another model. If so, then how do I utilize that? If not, then do I need to avoid ''id'' in any field names other than the main id field? Thanks! -- Posted via http://www.ruby-forum.com/.
2006 May 21
3
acts_as_list scope and polymorphic association.
this is my model: class Person < ActiveRecord::Base has_many :phones, :as => :callable, :order => :position end class Phone < ActiveRecord::Base belongs_to :callable, :polymorphic => true acts_as_list :scope => :callable_id end how can i add the callable_type to the scope. how can i say the scope is the {:callable_id,:callable_type} couple? is it even possible? thanks
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
2006 Mar 23
3
drag and drop sorting recipe
The new pragmatic Rails Cookbook has a drag and drop sorting recipe. Does anyone know if this works with 1.0? I''ve followed the recipe (i think), and I can drag but when I drop everything goes back the way it was. It seems that the sort logic doesn''t get invoked. I put this code in my view: <%= sortable_element ''task-list'' , :url => {
2006 Feb 15
9
newbie-> help understanding "magic" behavior
I am trying out ROR for the first time[1], and have much PHP poisoning to overcome in my mental baggage. That said, I was delighted to find that I could make a link from a "show" page to the next record in the database by simply adding @next_page = Content.find(params["id"].next) to my content_controller.rb and then constructing a link to it within my show.rhtml. The
2006 Feb 26
3
Rails Naming Conventions
DB field names: If I have a table that references 2 or more separate users from my users table, is there a recommended naming convention for this situation? In my case, I have 3 users associated with a record in my projects table: requester_user_id created_by updated_by I could name one of them "user_id", and then projects.user would work I guess, but wouldn''t work
2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
First, BRAVO for this wonderful plugin: has_many_polymorphs ! Now my problem: 4 models : Collection, Page, Fragment, Belonging (which is the join table): 1 class Collection < ActiveRecord::Base 2 has_many_polymorphs :elements, 3 :through => :belongings, 4 :from => [:pages, :fragments, :collections], 5 :as => :collector, 6 :parent_order =>
2010 Oct 13
2
acts_as_list issue in single table inheritence
Hello Rails experts, Need your help in following issue with the acts_as_list and single table inheritence Code details : http://pastie.org/1214846 Hello Rails experts, Need your help in following issue with the acts_as_list and single table inheritence Code details : http://pastie.org/1214846 But here I need create those entries with the scope on Relater only and not on RelaterFeed or
2005 Oct 14
1
join tables and position (acts_as_list)
I''m working on some schema for a new project that we''ll be doing in rails (our first rails project!). A recurring structure we are seeing is the desire to define an ordering any way we wish, so ''acts_as_list'' comes to the rescue. But, the ''position'' column seems to need to belong in the join table to make sense. For example, we have
2007 Oct 18
4
Polymorphic Association?
Hi there- I''m a newbie to this board, RoR, and web development in general. So please forgive me if this is in the wrong place or if the solution is really simple... I''m trying to conceptualize the relationships between a series of models for a page creation function. What I''d like is to have a Content Page which consists of a series of Content Blocks. The Content
2007 Mar 28
1
acts_as_list nested scope
Here''s what I''m trying to do: class Model < AR::Base acts_as_list :scope => [:key_one_id, :key_two_id, :key_three_id] end with the idea being that there are these three references from this table (one of them being optional) that define the list. I don''t think acts as nested set works in this situation because I''m still just dealing with a single list