[Rails] question about post changes for a list of objects once
John Wilger
johnwilger at gmail.com
Mon Dec 6 18:52:52 GMT 2004
It's not necessarily a _Rails_ standard way to handle this, but it's a
simple enough solution---for each field, set up the inputs as
array-style inputs and include the record's id:
<input type="text" name="myobjects[<%=obj.id%>][some_field]" />
Then, in the receiving controller, @params['myobjects'] should be a
collection of the input values keyed on each id, i.e.:
@params['myobjects'][1]['some_field']
@params['myobjects'][24]['some_other_field']
etc.
At least, this is the way, I'd expect @params to behave---anybody know
differently?
On Mon, 6 Dec 2004 12:25:25 -0600, ChongQing Xiao
<cqxiao at epicsystems.com> wrote:
> Hi,
>
> In the web browser, I have a grid to show a list of object (say a list
> of post or appt), the user can edit individual row in the client without
> post data back to server (using javascript),
> After the change, the user will click a submit key to post changes back
> to server and file the change once.
>
> Does rails have some standard way to handle this?
>
> Also for the following code (I copied from the example in active record)
> logger.info "\nUsing has_and_belongs_to_many association"
> david = Person.find(1)
> david.add_companies(thirty_seven_signals, next_angle)
>
> Is anyway to add the companies using company ID instead of using the
> company object so I don't need to call company.FindOne("123") since I
> don't need other information for the company?
> -- Something like David.add_companiesByID("123")
>
> Thanks
> chong
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Regards,
John Wilger
-----------
Alice came to a fork in the road. "Which road do I take?" she asked.
"Where do you want to go?" responded the Cheshire cat.
"I don't know," Alice answered.
"Then," said the cat, "it doesn't matter."
- Lewis Carrol, Alice in Wonderland
More information about the Rails
mailing list