search for: shyang

Displaying 20 results from an estimated 21 matches for "shyang".

Did you mean: shang
2006 Mar 21
13
"Remembering" link to redirect to after logging in
Hi, Suppose I have a resource such as http://localhost:3000/topsecret/data that requires the user to login first. What I did was make use of before_filter to check and see if the session variable is set with the logged in user''s id (similar to the example in "Agile Web Development with Rails"). However while the filtering function does work correctly in redirecting the
2006 Jan 13
5
Form field naming semantics question
Hi, I have a question today regarding how the various form elements in _form.rhtml are named. I understand that for a database table "persons" with a column headed by "name", then in _form.rhtml it will probably be like: <p><label for="person_name">Name><br/> <%= text_field ''person'', ''name''
2006 Mar 21
4
Using onSubmit tag in form_tag?
Hi guys, I have been working on a form that would use javascript to validate the data before submitting it, and from my view.rhtml I have a statement like this: However such a statement generates a HTML tag that looks like this: <form action="/users/Login?onSubmit=validate%28%29" method="post"> Seems like Rails thinks it is a parameter instead of an option, so
2006 Mar 23
1
Implementing a model with logging?
Hi, I''ve been trying to work out a model (let''s say a StudentRecord) which has a number of attributes, and the key thing I''m trying to do here is to implement it such that you can actually view modifications made over time by various users (think of it as a wikipedia style of logging). Is there some provision in rails that''d provide this functionality for
2006 Mar 24
1
Modifying a session variable from a different process?
Hi, I''ve implemented a log in session "thing" that essentially works by holding the model of the logged in user in a session variable, like this: session[:user] = user However let''s say at this point in time, should an administrator of the system decide to revoke this user''s account, the session variable for that currently logged in user is still valid,
2006 Jan 12
1
Does rails support method overloading?
I''ve tried to have 2 methods of the same name (but with different parameter signatures) and it always seems like the later declaration tends to win out, does this mean that ruby does not support overloading? If so what aboutt the .new method? You can either call it as .new (with nothing) or .new(hash variable). Is it possible to override a specific instance of the zero parameter
2006 Jan 14
2
Why can''t I changed the _session_id cookie?
Hi, I noticed that there is a cookie set by my rails scaffold that contains a 32 character hash code in it, but when I tried to change its value using Cookies[:_session_id], nothing happened, it stays the same! How am I supposed to change the session_id? Thanks. -- Posted via http://www.ruby-forum.com/.
2006 Jan 17
2
Instant Rails request lags >4 sec
Hello RoR folks, I am using Instant Rails and a small app that currently uses scaffolding for CRUD on just one table with 7 attributes. I am not shure wether scaffolding slows down the app that much but I have a time lag for every request with above 4 sec. The preinstalled apps like Type are running damn fast, which is not the case for my stuff. Any help on this would be great Thanks, RTG --
2006 Feb 04
1
Error when using form helper and child objects
Hi, This is one problem that has gotten me stumped for quite a while. I have an Item that has_many :DeliveryMethod, and what I seek to achieve is to create a form that''d let me create an Item, as well as its DeliveryMethods in 1 single form. And so I tried something like: <%= text_field_tag ''Item[DeliveryMethod][price]'', @Item.DeliveryMethod ?
2006 Jan 18
22
Creating multiple child objects from the same form
I''ve been digging into rails, but this one question has been a two day stumper. I''ve got a question/answer model that I''m trying to work out. Each question has multiple answers (they''re more like choices, it doesn''t matter whether they''re right or wrong), and I''d like to have the question creation form also have multiple fields in
2006 Feb 03
7
how to add multiple new records from one form
I''m trying to provide our customers with a page where they can add up to 20 items to their cart in one form. The form simply has 20 rows with each row containing a text input for product code and a text input for quantity. I''ve tried having the controller create an array that has an object for each row by looping through something like: @new_items[1] = Cart.new and the
2006 Mar 24
0
A "virtual model" that encapsulates other models?
Hi, Is it possible to have a model in rails that does not exist as a database table by itself, but it exists solely by pulling data together from tables used by other models? For instance, let''s say I have a model of a "customer" which has_many "addresses", of which one of the "addresses" is the default address. So what I''d like to do is to
2006 Feb 03
0
Instantiating multiple child objects
Hi, I''ve been tinkering a bit with Ruby lately, and is truly amazed by its automation, however some of it is a bit arcane for a newbie to understand :| Let''s say for instance I have a object Person which has_many VehicleRegistrations, and I want to have a form that would enable me to instantiate many VehicleRegistrations at once. So supposing my form enables 2
2006 Feb 04
1
Specifying multiple foreign keys to another table?
Hi, By convention, if I have a field that is a reference to another record in the `users` table, all I would need to do is to name the column `user_id` and RoR would know it is a reference. However currently I am working on a table that records `actions` that both impact on another user, with each action performed by another user. Thus I''d have 2 columns like `impacted_user_id` and
2006 Feb 16
1
Some questions about Ajax.Updater
Hi everyone, I''ve been thinking of actually getting rid of the Rails javascript tag helpers, and making calls to the prototype library directly from the javascript functions that I made, however there are some bits that I don''t quite seem to get... Does this method block until it completes? As in, suppose I use it in a block of javascript, will the code that''s
2006 Feb 17
0
"unable to get local issuer certificate" OpenSSL errors?
I''ve been trying some sample programs that involves posting requests to a secured web server, but it seems like none of them work at all due to this error. I''m currently using InstantRails, is there anything I can do to fix these errors? Thanks. -- Posted via http://www.ruby-forum.com/.
2006 Jan 12
1
Overriding the initializer
Hi, A question that I have been thinking about is.. by the time the initialize method is called, has the instance of the object already been created? I''ve been thinking of creating a class object that would only have one given instance based on a given attribute (ie: a "Town" object, whereby only 1 town can exist in the entire table with a particular postal code) but to
2006 Jan 14
0
Overriding column accessors?
Hi, Is it possible to override the default accessors that are created by Rails? For instance I had this User object which has the column headings "password" and "salt" in its SQL table. I did manage to override the setter accessor for password by using def password=(new_password), but when I tried doing the same for the reader by using a def password method (to return a
2006 Jan 17
0
Dynamically creating textbox in form?
Hi, What I''m trying to hack up is a form that has a portion which would allow me to add "any number" of another set of items. For instance when specifying a product in a table, and this said product can have a number of ways which it can be delivered, so I will have a "Add additional delivery method" javascript link, which when clicked will create an additional
2006 Feb 03
2
_form rendering question for adding multiple child objects
Hi I have been following a thread here.. http://www.ruby-forum.com/topic/new?forum_id=3 but it did raise some new curiosities that I hope someone can help address here :) In particular it is with Duane''s super secret hack that works for multiple child objects > There''s a super-secret and mostly undocumented way of doing this > that''s kind of handy, actually.