similar to: question about saving associations when using has_many :through

Displaying 20 results from an estimated 600 matches similar to: "question about saving associations when using has_many :through"

2006 Mar 18
1
Need help .. Rails Recipes, in_place_editor, selecting associations
Hi, I am currently reading the Rails Recipes book and like the chapter on providing your own in_place_editor for enumerations / selects. I understood so far, or I believe that I understood ;-), how to do that for a field that uses values only, like choosing from "red", "black", "green". What I fail to understand is how to chose from associated objects?!
2014 Apr 16
0
Configure restful web service in rails
Hi, I am trying to create a Rest web service in my rails application. I need to configure urls for it as below. localhost:3000/book/book_id/new/param1/param2/param3/param4/... localhost:3000/book/book_id/next localhost:3000/book/book_id/delete I dont have a view pages for it since it returns in json format.Please help.So what is the best way to configure these urls via
2010 Aug 28
1
validates_uniqueness_of missing in rails 3.0 rc2?
Has anybody noticed validates_uniqueness_of missing in rails 3.0 rc2? I''m not sure if this is a bug or I''m just doing something wrong. Here''s what I''m doing. Class 1: class Title < ActiveRecord::Base validates_length_of :language, :is => 3 validates_uniqueness_of :language, :scope => :book_id validate :language,
2006 Apr 05
0
Has Many :through associations
Greetings again: I''m simplifying the case I presented earlier regarding the use of has_many :through. I''m using DHH''s example from "Persuing Beauty with Ruby On Rails". Here are his models: class Author < ActiveRecord::Base has_many :authorships has_many :books, :through => :authorships end class Book < ActiveRecord::Base has_many
2006 Mar 19
3
Table belongs_to either of two other tables?
Suppose I have a site about books and authors, and users can leave comments on either a book or an author. I''d want to have a table called "comments", which could belong to either an author OR a book. In my structure I wouldn''t be sure whether to include an "author_id" or a "book_id", or both. What would be the best way to handle this
2007 Aug 15
3
ActsAsList specs
Hi, How are people specifying models which act_as_list? I''m thinking that it would be possible to check that acts_as_list instance methods have been added to a class using something like this: describe Page, "acts_as_list" do it "should act as a list" do Page.ancestors.should be_include(ActiveRecord::Acts::List::InstanceMethods) end it "should use
2005 May 25
2
URLS and Human Factors
This post addresses URLs generated by Ruby on Rails from a human factors point of view. Allow me to use Hieraki as an example. Hieraki is a great application. It was one of my first introductions to the power of Ruby on Rails. Scenario: When I navigated to Chapter 1 of a book the URL in my address bar was http://www.library.com/read/chapter/6. This inconsistancy ("Am I on Chapter 1 or
2006 Aug 11
2
User Favorites
Hi there, I''m currently creating a simple (at least so I thought) structure of user favorites. Basically users can add certain ''objects'' to their list of favorites. Here is my current structure (simplified) class User has_many :favorites end class Book belongs_to :favorites end class Favorite belongs_to :user has_one :book end The table favorite just has a two
2017 Oct 05
0
RFM Analysis Help
Hi Hemant, As I suspected, the code broke when I got to the line: result <- rfm_auto(df, id="user_id", payment ="subtotal_amount", date="created_at") Error in rfm_auto(df, id = "user_id", payment = "subtotal_amount", date = "cr eated_at") : could not find function "rfm_auto" It looks like you are using the hoxo-m/easyRFM
2017 Oct 06
3
Help RFM analysis in R (i want a code where i can define my own breaks instead of system defined breaks used in auto_RFM package)
I'm trying to perform an RFM analysis on the attached dataset, I'm able to get the results using the auto_rfm function but i want to define my own breaks for RFM. as follow r <-c(30,60,90) f <-c(2,5,8) m <-c(10,20,30) but when i tried to define my own breaks i got the identical result for RFM i.e 111 for every ID. please help me with this with working R script so that i can get
2004 Aug 20
2
make_user_info_map in log with blank Doman and UserID args
Samba 3.0.5 Debian Package Kernel 2.6.7 custom compile on Debian Testing Configure Samba per my KLUG presentation on Samba PDC to Win2K Clients: ftp://ftp.lueckdatasystems.com/pub/presentations/klugsamba3pdc-bookreview.pdf In the error condition, a user account is assigned to the domadmin and ntadmin Linux groups. In smb.conf -> admin users = @domadmin On the workstation there are mappings
2010 Sep 21
25
Working in install acts_as_commentable, On create, error: "unknown attribute: book_id"
Hello, I''m working to install the acts_as_commentable plugin on my Rails 3 app. After adding "acts_as_commentable" to my book model, I then added a comment form on my book show view: <% form_for(@comment) do|f| %> <%= f.hidden_field :book_id %> <%= f.label :comment %><br /> <%= f.text_area :comment %> <%= f.submit "Post
2004 Aug 22
1
Someone with "Access Denied" from Windows pls try this test to compare notes with me
Long day yesterday for us here, first production implementation of Samba has to be rolled out and the client's old network reinstalled... cause: this "access deneied" issue which seems to be randomly affecting Samba implementations and from what I can see folks say Samba 3.0.2 was the last good build. If that describes you, please test this as I have come up with a way to turn the
2006 Jul 06
0
Paging with multiple tables/models
I''m looking for a smooth way to implement paging over a combination of two tables. My application tracks which books and movies you have borrowed from me. For reasons that make sense elsewhere in the application, these are seperated out into two tables: book_borrowers and movie_borrowers and therefore 2 different activerec objects: BookBorrower and MovieBorrower This particular screen
2006 Dec 25
2
how to insert data using has_and_belongs_to_many
I''am newbie in RoR, so my question might look stupid, but I stuck in one thing. I''ve created 3 tables: users{ id, user } books { id, book } books_users{ book_id, user_id} Model class Book< ActiveRecord::Base has_and_belongs_to_many:users I can''t figure out how to insert data to the books_users table. For example users post info about new book and information
2006 Mar 04
10
Help setting up relationships needed
This is a bit of a long question, but to those of you with some experience, it should be fairly simple I think. I have a notes page that should list all notes the user has entered for all books chronologically like this. Book One: This is the note. Book Four: This is the note. Book One: A different note, entered later. Right now my models are: User has_many :books Book has_many
2005 Dec 29
3
Verification problems
Hello, Hope this isn''t a newbie question - but I don''t seem to be able to find relevent information elsewhere. I am having trouble getting the following to work: Schema ====== ActiveRecord::Schema.define(:version => 1) do create_table "authors", :force => true do |t| t.column "name", :string end create_table "books", :force =>
2006 Jan 18
2
categories/recipes & books/descriptions - has_many vs has_one => id question
People, In the cookbook eg, categories has_many recipes but in a book eg, book has_one description - doesn''t that mean that the id of the description should be the same as the id of the book (instead of having it''s own "description_id" in the book table? Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275) GPO Box 3411 Sydney
2005 Mar 08
19
find_by_sql ON STEROID possible?
find_by_sql BREAKS THE OOP BEAUTY and perhaps we can solve that. NAMING CONVENTIONS can perhaps make find_by_sql much more clever. lets imagine that relation: publishers <- books <-> authors_books <-> authors -> universities (can''t find something else than university for that last association :) ) imagine we want to fetch every book and every associated
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi, I''m a bit stuck with mocking a unit test of a join model with regards to a validates_uniqueness_of clause. I have class Book < AR:B has_many :clippings various validates_presence_of etc end class Clip < AR:B has_many :clippings various validates_presence_of etc end class Clipping < AR:B belongs_to :book belongs_to :clip validates_uniqueness_of :clip_id,