Just i called one function in my program, but i need to pass one
json parameter...But getting the error like
*ArgumentError (Unknown key: branch_id):*
*
*
CODE
*
*
*branch1(params[:branch])
*
*
*
*def **branch1**(branch)
*
* branch123 = Branch.find(params[:branch])
*
*end*
*
*
And my rest-client body is

*{"user":
{"password":"password","user_name":"user2"},"branch":{"branch_id":"1"}}
*

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TYBQZXmnIWAJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Apr 3, 2012 at 12:10 pm

    On 3 April 2012 12:55, amvis wrote:
    Just i called one function in my program, but i need to pass one
    json parameter...But getting the error like
    ArgumentError (Unknown key: branch_id):

    CODE

    branch1(params[:branch])

    def branch1(branch)
    branch123 = Branch.find(params[:branch])
    end

    And my rest-client body is

    {"user":
    {"password":"password","user_name":"user2"},"branch":{"branch_id":"1"}}
    Do you mean that is the value of params? If so then params[:branch]
    is a hash rather than a id value. Perhaps you mean
    find(params[:branch][:branch_id]), or perhaps I misunderstand what you
    are trying to do.

    Colin
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/TYBQZXmnIWAJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    gplus.to/clanlaw

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Amvis at Apr 3, 2012 at 12:18 pm
    i need to get the values from the :branch. so when i call the function *
    authenticate_for_branch*, how to pass that branch and accept that...?
    Thank you
    vishnu


    On Tuesday, 3 April 2012 08:09:14 UTC-4, Colin Law wrote:
    On 3 April 2012 12:55, amvis wrote:
    Just i called one function in my program, but i need to pass one
    json parameter...But getting the error like
    ArgumentError (Unknown key: branch_id):

    CODE

    branch1(params[:branch])

    def branch1(branch)
    branch123 = Branch.find(params[:branch])
    end

    And my rest-client body is

    {"user":
    {"password":"password","user_name":"user2"},"branch":{"branch_id":"1"}}
    Do you mean that is the value of params? If so then params[:branch]
    is a hash rather than a id value. Perhaps you mean
    find(params[:branch][:branch_id]), or perhaps I misunderstand what you
    are trying to do.

    Colin
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/TYBQZXmnIWAJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    gplus.to/clanlaw
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/U26tcu0h4lMJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Murali dhararao at Apr 3, 2012 at 12:58 pm
    Hi,

    Get the data of
    branch=params[:branch] [:branch_id] unless params[:branch].nil?

    send this branch to the method.
    On Tue, Apr 3, 2012 at 5:48 PM, amvis wrote:


    i need to get the values from the :branch. so when i call the function *
    authenticate_for_branch*, how to pass that branch and accept that...?
    Thank you
    vishnu


    On Tuesday, 3 April 2012 08:09:14 UTC-4, Colin Law wrote:
    On 3 April 2012 12:55, amvis wrote:
    Just i called one function in my program, but i need to pass one
    json parameter...But getting the error like
    ArgumentError (Unknown key: branch_id):

    CODE

    branch1(params[:branch])

    def branch1(branch)
    branch123 = Branch.find(params[:branch])
    end

    And my rest-client body is

    {"user":
    {"password":"password","user_**name":"user2"},"branch":{"**
    branch_id":"1"}}

    Do you mean that is the value of params? If so then params[:branch]
    is a hash rather than a id value. Perhaps you mean
    find(params[:branch][:branch_**id]), or perhaps I misunderstand what you
    are trying to do.

    Colin
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/**msg/rubyonrails-talk/-/**TYBQZXmnIWAJ<https://groups.google.com/d/msg/rubyonrails-talk/-/TYBQZXmnIWAJ> .
    To post to this group, send email to rubyonrails-talk@googlegroups.**
    com <rubyonrails-talk@googlegroups.com>.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@**googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com> .
    For more options, visit this group at
    http://groups.google.com/**group/rubyonrails-talk?hl=en<http://groups.google.com/group/rubyonrails-talk?hl=en>
    .

    --
    gplus.to/clanlaw

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/U26tcu0h4lMJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    Thanks & Regards,
    MuraliDharaRao.T
    +91-9642234646

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedApr 3, '12 at 11:55a
activeApr 3, '12 at 12:58p
posts4
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase