Displaying 20 results from an estimated 1000 matches similar to: "NewBie question"
2006 Aug 07
2
Select Box Question
Hi,
Yet another newbie here... I''m writing an appliction in Rails, and I''ve
Ajaxified my select boxes so they update dynamically. I used the
"observe_field" method to monitor changes to my select box. I find that
it''s kind of erratic... it updates constantly and makes the selection
for me, based on where my mouse happens to be hovering when it does its
2006 Jul 08
2
Creating/Saving dependent objects
Folks,
Am new to RoR and am building an example to get myself familiar. I am
running into a simple issue while creating a user registration page.
I have a User and Address models defined as below (partial/relevant code
included below). User has_one address and Address belongs_to user. I have a
foreign key defined in address table that refers to user(id)
In a form I take in username, password,
2006 Jan 26
1
Transactions for multiple models
I have users and companies tables where users belongs_to companies.
def signup
@company = Company.new(params[:company])
@user = User.new(params[:company])
@user.company = @company
if @user.valid? and @company.valid?
@company.save
@user.save
end
end
How can I make this into a transaction? Is this a candidate for a
distributed transaction?
If so, from what I understand from the API,
2005 Dec 16
6
managing belongs_to fields in a form
Hi all,
I cannot find a clean way to create/edit an object that ''belongs_to''
another one, just by using form fields.
I always need to explicitely unassemble it, store the master id in a
hidden field, and then refetch the master from its id, and put it back
in the object.
To summarize:
I want to create a new member, for a given project
@project= ...
@member =
2005 Jan 24
1
.call file creation
I am curious partly because it has occurred randomly in my asterisk
system. How does one go about creating a .call file for placing a call
between two extensions/phones? I know this has been mentioned and is
probably in one of the wikis somewhere, but I am unsure exactally how to
go about doing it. Can anyone point me in the right direction.
Dan
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2006 Jan 03
4
Would someone like to tell me why this code will not solve my problem? (it''s short)
I am building an invoicing system but cannot use the auto_increment
field to determine the invoice number (because they are running 3
different companies off the one system. I need to find the last
invoice number from any given company and then add 1 to it to get the
next invoice number. BUT, there is a unique case on the very first
invoice produced because there is no earlier invoice
2006 Jul 25
6
DRY question (newbie)
Say i want to include the same chunck of text (a menu on a webpage for
example) on each page. Is there a method by which I can save the HTML in
a text file and call it up later? Is there a better way?
I know ruby has "puts" but i can''t use that b/c it does not work with my
webhost (dreamhost.com)
Any suggestions?
--
Posted via http://www.ruby-forum.com/.
2006 Feb 03
6
Saving a User Object while in the Address Controller
Hi,
My saves are failing me and I can''t figure out why.
I am trying to save an address id to a user object just after I create
the address.
This isn''t the exact code, but it shows what I am trying to do.
class AddressesController < ApplicationController
def create
@address = Address.new(params[:address])
saved_address = @address.save
@user =
2006 Aug 15
5
XML question
Is there a way you can use RoR to create an .xml file?
Say I had a DB full of info that I wanted to format and have export as
"lorem.xml" inside of a specific directory in my web server?
Then, each time I updated the DB it would re-export the file (delete the
old, save the new?)
--
Posted via http://www.ruby-forum.com/.
2007 Jan 24
2
A spec where interaction-based testing breaks down... (at least for now)
Here are the specs:
context "Finding all the stylesheets available to a company" do
setup do
@mock_company = mock("company")
@mock_company.stub!(:to_param).and_return "1"
Stylesheet.stub!(:find)
end
def do_find
Stylesheet.find_available_to @mock_company
end
specify "should convert the company into a parameter" do
2005 Sep 02
7
Form to update two tables
Hello there,
this is probably a very simple problem but I''m stuck.
I''m following the Login generator tutorial from rubyonrails. It''s all
worked fine so far. But I want to add a bit more functionality so that
when a user signs up in addition to chosing a login name and password
they type in a company name which is added to a seperate table called
COMPANIES. The id
2006 Jul 04
4
Please help me
Hi all,
I''m getting the list of my projects in the page. But i want to get
the list according the month, i.e., if i select july in the drop down
then i should get the
list of projects done in the month of july..
Please reply..
Regards,
Harish
--
Posted via http://www.ruby-forum.com/.
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All,
I am new to ROR, and can''t seem to get HABTM to cooperate entirely...
however I might be abusing it! Before I try a different strategy I
thought I''d ask here and see if I''m missing something simple.
So say Projects and Companies are related. Projects can have multiple
Companies, and Companies can be on multiple Projects. But, the same
Company can also
2006 Jul 28
2
gem install (Errno::EACCES)
I am finding it impossible to install a gem, and even more impossible to
find help.
Can anyone PLEASE help?
- - - - - - - - -
Mason-Kessingers-Computer:~/Desktop/rails/pygmalion masonkessinger$ gem
install login_generator
Attempting local installation of ''login_generator''
Local gem file not found: login_generator*.gem
Attempting remote installation of
2006 Jan 09
3
Design Question
I am sure some of you can give me an insight into this. This is more
towards the database design for the scenario below:
Say for example,
I have a person table and this person can have different address types.
One could be Home and the other could be say Office.
Should be model this
Table people
id
fname
lname
Table addresses
id
person_id
addr1
addr2
....
or
Table people
id
fname
lname
2006 May 17
4
NOOB: Representing linked objects in one form
Given two models:
User
:name
:email
:address_id # foreign key
Address
:line_1
:line_2
:city
etc.
I want to have a form allowing a user to register, in which she''d enter
an address as well, but how do I go about combining both objects into
the one form?
I''m new to this and following along with the Agile Rails book from the
Pragmatic Programmers, but it
2006 Aug 16
5
too many SESSIONS?
I just notices my app was down, and in the log file were lots of these:
No space left on device -
../config/../tmp/sessions//ruby_sess.898b1cf95e14f8e3
So i figured that i had too many sessions. I went through and deleted
the sessions and then in a few minutes, the site was back up again.
Can anyone explain this?
Did I do the right thing?
Is there a way I can tell my app to accept more
2006 Sep 23
8
acts_as_rateable plugin help!
Hello,
I am having some trouble figuring out how to use the rateable plugin. i
followed as close as the directions located at
http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system
but i fail at working it.
i am getting this error
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.rating
Extracted source (around line #1):
1:
2006 May 19
1
ActiveRecord: Minor saving problem
This is probably a very stupid error on my side, but I am doing my
first steps now and I don''t see what is wrong.
I have companies and I have users. A user can create a company. When
the user does he''s automatically a member of the company. A company
should be able to have multiple users off course so every member of a
company can add other users who don''t have a