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

Discussion in 'Ruby' started by Agnisys, May 2, 2007.

  1. Agnisys

    Agnisys Guest

    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.
     
    Agnisys, May 2, 2007
    #1
    1. Advertising

  2. Re: Newbie question: How to get an object in the Controller froma view's hidden field

    Agnisys wrote:
    > 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.
     
    Phillip Gawlowski, May 2, 2007
    #2
    1. Advertising

  3. Agnisys

    zaphod Guest

    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
     
    zaphod, May 2, 2007
    #3
  4. Agnisys

    zaphod Guest

    On Wed, 02 May 2007 23:42:09 +0900, Phillip Gawlowski wrote:

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


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

    Do you know about a newsgroup where one can discuss rails topics?

    Regards
    Thomas
     
    zaphod, May 2, 2007
    #4
  5. Re: Newbie question: How to get an object in the Controller froma view's hidden field

    zaphod wrote:
    > On Wed, 02 May 2007 23:42:09 +0900, Phillip Gawlowski wrote:
    >
    >> Secondly:
    >> The Rails groups can help you more with this question, I guess:
    >> http://rubyonrails.org/community

    >
    > 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.
     
    Phillip Gawlowski, May 2, 2007
    #5
  6. Agnisys

    zaphod Guest

    On Thu, 03 May 2007 00:09:46 +0900, Phillip Gawlowski wrote:

    > zaphod wrote:
    >> On Wed, 02 May 2007 23:42:09 +0900, Phillip Gawlowski wrote:
    >>
    >>> Secondly:
    >>> The Rails groups can help you more with this question, I guess:
    >>> http://rubyonrails.org/community

    >>
    >> 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*?


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

    >> Do you know about a newsgroup where one can discuss 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
     
    zaphod, May 2, 2007
    #6
  7. Re: Newbie question: How to get an object in the Controller froma view's hidden field

    zaphod wrote:
    >
    > 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.
     
    Phillip Gawlowski, May 2, 2007
    #7
  8. Agnisys

    zaphod Guest

    On Thu, 03 May 2007 00:40:15 +0900, Phillip Gawlowski wrote:

    > zaphod wrote:
    >>
    >> 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..


    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.

    >> 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.


    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
     
    zaphod, May 2, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Diego

    Grid View hidden field

    Diego, Jul 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    495
    Diego
    Jul 19, 2005
  2. Michael Earls
    Replies:
    3
    Views:
    3,389
    MBUnit
    Mar 24, 2009
  3. Rick
    Replies:
    3
    Views:
    8,585
    Alexey Smirnov
    Apr 13, 2010
  4. GavMc
    Replies:
    4
    Views:
    378
    Evertjan.
    Sep 22, 2005
  5. Sound
    Replies:
    2
    Views:
    498
    Randy Webb
    Sep 28, 2006
Loading...

Share This Page