Newbie question: How to get an object in the Controller from a view's hidden field

A

Agnisys

Hi,
I'm trying to pass an object from the View to the controller as a hidden field.

Two quick questions:
For a hidden field, how do I pass a complete object to the controller?
For example, I have an object of type Issue, what should the second argument be in the
following:

<%= hidden_field("issue", ?, "value" => @issue) %>

Secondly, how would I access this object in the controller?

Any help would be appreciated.

Thanks,
Anupam.
 
P

Phillip Gawlowski

Agnisys said:
Hi,
I'm trying to pass an object from the View to the controller as a hidden field.

Two quick questions:
For a hidden field, how do I pass a complete object to the controller?
For example, I have an object of type Issue, what should the second argument be in the
following:

<%= hidden_field("issue", ?, "value" => @issue) %>

Secondly, how would I access this object in the controller?

Any help would be appreciated.

Firstly:

Please don't start a new topic by hitting "Reply" in your mail
application. This messes with the threaded view used by a significant
number of users, and you might not get answers.

Secondly:
The Rails groups can help you more with this question, I guess:
http://rubyonrails.org/community

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #5:

A project is never finished.
 
Z

zaphod

On Wed, 02 May 2007 21:03:00 +0900, Agnisys wrote:

I really do not understand, what you want to do. Which sense does it make,
to pass an entire object into a form and back to the controller,
when you do not want to manipulate it in the form? You could store it in
the session instead or fetch it from the database, when it lives there
after you got the form posted back.

From your posting one can assume, that you do not know nothing about rails
at all, then I would recommend to search http://www.rubyonrails.org/ for a
tutorial and http://api.rubyonrails.org/ for the APIs documentation or
read a book like "Agile Web Development with Rails" from Dave
Thomas and David Heinemeier Hansson.

If you want more help here, please describe your problem more detailed.

Regards
Thomas
 
P

Phillip Gawlowski

zaphod said:
But what about people, who do not want to use ugly webforums or
even-more-ugly mailing lists which flood their mailboxes?

What do you think is *this*? If you don't want to use the sources of
information that are available to you, you are out of luck, harsh as it
may sound.
Do you know about a newsgroup where one can discuss rails topics?

Very first entry on this website:
http://rubyonrails.org/community

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #15:

If you like it, let the author know. If you hate it, let the author
know why.
 
Z

zaphod

What do you think is *this*?

A news group about "ruby"? As far as I understood your last posting,
comp.lang.ruby is not for discussing rails topics.
Very first entry on this website:
http://rubyonrails.org/community

The very first entry "general list" is not a news group but a google
group, for which I need a google account - or am I wrong and there is a
way to use them in my newsreader via nntp?

Ragards
Thomas
 
P

Phillip Gawlowski

zaphod said:
A news group about "ruby"? As far as I understood your last posting,
comp.lang.ruby is not for discussing rails topics.

On my end, it's a mailing list. For others, it is a webforum..

In general, you want to ask Rails questions in the Rails mailinglist, as
your chances of getting an answer are higher by an order of magnitude.
The very first entry "general list" is not a news group but a google
group, for which I need a google account - or am I wrong and there is a
way to use them in my newsreader via nntp?

I have no clue. I use the email feature Google Groups provides. You'd be
better of to seek for that answer in the Google Groups support.

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #8:

Open-Source is not a panacea.
 
Z

zaphod

On my end, it's a mailing list. For others, it is a webforum..

And on my end it is a usenet newsgroup. But as far as I know, even google
makes a difference between usenet and mailinglists or google groups though
they have built various gateways into usenet. And usenet people definitly
do.
In general, you want to ask Rails questions in the Rails mailinglist, as
your chances of getting an answer are higher by an order of magnitude.

Yes. But I am searching for a usenet newsgroup for rails because without a
comfortable newsreader I would not read it anyway. But you are probably
the wrong person to ask.
I have no clue. I use the email feature Google Groups provides. You'd be
better of to seek for that answer in the Google Groups support.

Again: I am not using google at all. But to get a clue, what I am talking
about: http://en.wikipedia.org/wiki/Usenet

Regards
Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top