Displaying 20 results from an estimated 10000 matches similar to: "Transactions for multiple models"
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
13
NewBie question
Hi,
I m very new to Ruby.
I bought a book "Ruby on Rails" and I think I understand some concepts.
My question is :
Is there a way to not use "Cookies" or "Sessions Variables" to keep some
information about the user.
I ask this question because I would like to prevent some cases where the
user browser won''t accept cookies.
I m from Asp 3.0, and I
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 =
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,
2010 May 21
0
Multiple Models one form and validations ... no transactions(mongo)
I am trying to setup a sigup form thats pretty much just like the
basecamp form. https://signup.37signals.com/basecamp/Plus/signup/new
I want to create
a User
a Studio
and a Subscription(chargify)
a Subscription belongs to a Studio and not to a User. User gets tagged
onto a Studio via an admin array.
Is there any way to do this all in one form and still get back
validation errors etc without
2005 Dec 15
2
efficient INSERTS
Hi,
I''ve got the following models:
Company
Package
with a habtm relationship.
In my controller, I have a ''dispatch'' action which does the following
@companies.each do |company|
@packages.each do |package|
company.packages.push_with_attributes(package, :sent_on => Time.now)
end
end
my table ''companies_packages'' therefore lists which
2006 Jul 25
8
Creating records in two models in a RESTful way.
Hey everyone,
I have a philosophical question here. Say I have a website that uses two
models for accounts: Person and Company. Normally I would just have
/accounts/new for user signup.
However, the RESTful way to do it is to have /people and /companies.
Unfortunately, this doesn''t account for a situation where you''d have a
one-page signup form. I wouldn''t want
2007 Jul 18
3
Help. Acts_as_Authenticated plugin stops working for me?
Hi,
I successfully installed AAA couple days before, and i managed to
register a uer with it, with no user activation.
but for some strange reason, it stops working for the signup method,
with i go to the signup page, press submit, it shows an error page,
what''s wrong? here''s the error page.
undefined method `activation_code'' for #<User:0x3b6dbd
2008 Jul 09
1
loverays invites you to join Zorpia
Hi speex-dev!
Your friend loverays from , just invited you to his/her online photo albums and journals at Zorpia.com.
So what is Zorpia?
It is an online community that allows you to upload unlimited amount of photos, write journals and make friends. We also have a variety of skins in store for you so that you can customize your homepage freely.
Join now for free! Please click the following
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 07
1
question about routes and using flash for navigation
I have a flash movie that I''m using for site navigation.. I have links such as:
''/site/signup'', ''/site/login'' and ''/site/faq'' where site is my
controller and signup, login or faq are my actions.. I also have the
following routes defined in routes.rb:
map.connect "/", :controller => "site", :action =>
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 Jun 24
1
DRY up link_to_remote and its url_for
In an attempt to provide a gracefully degradable link_to_remote, I
repeat myself every time:
<%= link_to_remote(''Signup'',
{:url => {:controller => ''user'', :action => ''signup''}},
{:href => url_for(:controller => ''user'', :action => ''signup'')}) %>
Looked around the RDoc &
2006 Feb 01
1
Bus error when running Hieraki
I have been trying to set up Hieraki 2.0.1 and I cannot seem to
get it running. I am running on FreeBSD 5.4, Ruby 1.8.4,
Apache 2.0.55, Mysql 4.1.16, ruby-mysql 2.7, mod_scgi 1.9,
scgi_rails 4.3 and Rails 1.0. I can start up the wiki, get
it to display the home page, and when I click on the signup link
the signup form displays. When I fill in the signup form and
click the signup button, the
2007 Jan 09
1
assert_redirected_to not working as expected
I''ve installed the "acts_as_authenticated" plugin and made some
modifications to the controller (app/controllers/account_controller.rb)
"signup" module as follows:
===
def signup
@page_title = ''Create Account''
@user = User.new(@params[:user])
if request.post?
if @user.save
session[:user] = User.authenticate(@user.login,
2012 Nov 06
2
rspec failure upon revisit
I just returned from a different project after taking a few weeks off of
my tutorial. I''m using Ruby on Rails 3 Tutorial - Learn Rails by
Example by Michael Hartl.
After rebooting my server I ran an rspec spec/ command to check to see
if there were any problems and this is what I received. I didn''t modify
anything except I did overwrite users_controller.rb and
2006 Mar 03
5
Quick question about @params
I was looking through the loginGenerator code and noticed the following:
Login:
User.authenticate(@params[:user_login], @params[:user_password])
Signup
User.authenticate(@user.login, @params[:user][:password])
The syntax of the call in the signup code confused me...what exactly
does @params[:user][:password] this return to me? Is the params
structure a multi-dimensional array? I would have
2005 Oct 12
4
Validating 2 related models at once not working
Hello,
I have a form that submits data to two related models/tables. One is
Customer the other is Address. Validation for Customer works fine but not
for the Address.
Class Customer < ActiveRecord::Base
has_one :address
validates_presence_of :login, :password, :email
validates_associated :address
end
Class Address < ActiveRecord::Base
belongs_to :customer
validates_presence_of
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
2006 Apr 17
2
probably easy q: flash before redirect
I''m a little perplexed why this isn''t working:
private
def check_authorization
user = User.find(session[:user])
if user.level == 100
flash[:notice] = "welcome, admin"
else
flash[:notice] = "ha ha"
redirect_to :controller