Displaying 20 results from an estimated 2000 matches similar to: "Another HABTM Question"
2006 Feb 13
4
Calling find()
Hello, sorry for the bulk question, but I cannot find answer anywhere,
I have model like Phonebook::Category, and i`m stuck on calling find()
method on this model ?
2006 Jul 12
1
odd habtm behavior? or is it me?
Hello List,
I''m a bit spent on this problem, and my code might be whack. I seem to be
encountering a problem where the primary key on a join table is not being
resolved correctly. I will elaborate after some code bits. I am creating
the join table using migrations, and relevant model code is this:
class Post < ActiveRecord::Base
has_and_belongs_to_many :records
2006 Feb 06
9
tests fine, but fail under rake
Hi there,
So I have an odd error at the moment that only occurs when I run tests
via rake. It''s happening with two tests now. Under a simple ruby run,
the tests are fine, e.g.:
D:\User\Code\ruby\prometheus>ruby
test\functional\story_comments_controller_test
.rb
Loaded suite test/functional/story_comments_controller_test
Started
.........
Finished in 2.37 seconds.
9 tests, 65
2006 Feb 14
2
AJAX on page load
Ok, I''m missing something obvious but after some reasonable looking in _The_
Rails book (sorry haven''t gotten the cookbook yet) and these archives I
don''t see a solution to my question.
Question:
What is the cleanest way to load a div via AJAX when the page loads - no
user action necessary. I don''t really want to hack in a hidden remote form
or link that is
2006 Feb 14
8
routing failures
probably something really simple but I don''t understand.
Shifting to Apache to w/ fastcgi (definitely feels faster than webrick)
Anyway, I set the default route in routes.rb to be
map.connect '''', :controller => "placements", :action => ''list''
which worked once I figured out apache...
Anyway, now that I have done that, all attempts
2006 Jan 16
4
Creating two records at once
Hi there,
I have a User model and a Profile model. A user has_one profile, and a
profile belongs_to a user. The profile model contains a user_id column
as the foreign key.
The problem comes in when I want a user to register. In the
user_controller I have a method that creates the user. I also want the
profile model to be filled in with the appropriate user_id foreign key
(I don''t care
2006 May 23
2
In Place Editor Fields and Safari
Hi,
Does anyone else have any problems with Safari and in place editor fields?
I''m specifically talking about trying to save a null value in a text box. In
Firefox/IE/Camino/etc... saving a null value from an in place editor works
how it''s supposed to. If the value is null, then ''click to edit'' is
displayed. However with Safari when a null value is saved,
2006 Feb 14
4
Newbie stumped by "NameError in "
Help. I cannot find any help by searching...
I''m slowly creating an application using tutorial examples, etc, but I
think I''m missing something real basic:
Here''s the error message:
NameError in Mindreadr#display_images_from_mindreadr
undefined local variable or method `mindreadr_open_socket'' for
#<#<Class:0x37c3b08>:0x37c3a30>
Here are
2006 Jul 24
4
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
Hi there,
I''ve been digging around trying to find some information (mostly examples)
on how one would handle a progress bar upload using BackgrounDRb and File
Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of
course, but I still have a few questions.
I made a simple upload form (as a test) that is submitted to the
"upload_song" action.
def
2006 Feb 07
4
Ruby, Rails & Inheritance
Hi!
I am looking for a solution for the following problem:
Some of my models share some attributes and also was in need for some
extra features, so I created a class "RecordWithFeatures":
-----------------------------------------------------------------
class RecordWithFeatures < ActiveRecord::Base
# @Override
def self.descends_from_active_record?
superclass ==
2006 Jun 07
1
How do YOU read/update HABTM?
In my mind, it should work like this:
<%= select ''item'',
''category_ids'',
Category.find(:all).collect {|c| [c.name, c.id] },
{},
{:multiple=>true, :size=>20} %>
Then Rails should automatically populate and update HABTM on that. As it
is now, the above won''t work (I created a getter in item''s model that
returns an array of
2006 Feb 06
35
ROR Recipes Beta
Yesterday I got the beta version of ROR recipes book and the recipes are great. For those of you still thinking about it, I highly recommend the book.
The only thing I wish is that if there were some more recipes (greedy me), especially AJAX related and installing an application within your current application.
For instance, it will be great to see how one can implement the typo blog
2006 Feb 17
3
Migration Errors?
Hi there,
I just bought the Rails Recipes and PDF preview of the book. So far
it''s excellent. I decided to try Chapter 8 of the book regarding
tagging.
I''ve done migrations before, and I feel comfortable with them, however
this error stumps me.
--------------------------------------------------
antrover:~/RubyProjects/rlog dhoefler$ ruby script/generate migration
2006 Jun 29
2
HABTM with multiple select list
Hello,
I am very new to ruby and need to create my first HABTM with multiple
select list.
I am having problems saving data in the middle(linking)
table.
1. titles can have multiple categories
2. categories can have multiple titles
Categories, titles and categories_titles tables are created.
----- title_controller.rb--
def new
@title = Title.new
@categories =
2006 Apr 20
2
Image Display Question
Hello there,
I have something odd happening to my image tags when displaying an image.
Here''s what my ''<img src>'' tags are looking like:
<img alt="2-thumb" src="/images/public/uploaded_images/2-thumb.jpg?" />
Notice the question mark at the end of the string. I have no idea where this
coming from. Here are the important parts of my
2006 Feb 04
22
What''s the best way to embed a form?
I would like to embed my login form on my app''s home page. What''s the best way to render the login action of member controller from another action?
Thanks
Frank
---------------------------------
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 10
5
Select Tag and Associations
Hi there,
I''ve been working on this for awhile and have finally decided to ask
for a little guidance.I have a slight problem trying to save a
selection.
I have two models:
A "Posting" has_many "Categories", and a "Category" belongs_to one
"Posting". With that said, in the posting model I have "has_many
:categories" and within the
2006 May 16
2
before_filter and the application controller
Hi there,
I''m having a bit of an issue with my before_filter. I know that the filters
put in the application.rb controller are global for all the controllers. In
my application filter I''d like to allow access to the RSS feed method in a
''member'' controller and skip the login checks that the before_filters are
currently performing.
In my application my filters
2006 Feb 06
4
Basic MVC in RoR question
Ok, Here''s my controller:
def create
trainingplan = Trainingplan.createplan(@params[:startdate],
@params[:enddate], @params[:hoursperweek], @params[:programtype])
end
My model is:
class Trainingplan <ActiveRecord::Base
def self.createplan(stardate, enddate, hoursperweek, programtype)
stardate = startdate
enddate = enddate
hoursperweek = hoursperweek
programtype
2009 Jun 22
5
has_many through , or habtm , using form
i think there ara two ways of relate products and categories ,
basically i want to fix one product(e.g hp dv7....) to some categories
(notebook,17"notebooks...)
i made a table named categorization(incuding category_id,product_id
fields) then in models i write these codes below
class Product < ActiveRecord::Base
has_many :categories, :through => :categorizations