route_param not found for API:Class

77 views
Skip to first unread message

Maxwell Bernstein

unread,
May 21, 2013, 4:44:04 PM5/21/13
to ruby-...@googlegroups.com
I have an application API I'm working on with Grape, and part of it looks like this:

   desc "Get a post by user and id."
    params do
      requires :username, type: String, desc: "Username."
    end

    route_param :username do
      params do
        requires :id, type: Integer, desc: "Status id."
      end

      route_param :id do
        get do
          Post.first :user => { :username => params[:username] }, :id => params[:id]
        end
      end

      get do
        Post.all :user => { :username => params[:username] }
      end
    end

That should be all well and good, except for I get the following error:

undefined method `route_param' for API:Class (NoMethodError)

How can I remedy this?

Thank you,
Max

P.S. I am using Ruby 2.0.0

Daniel Doubrovkine

unread,
May 21, 2013, 5:53:59 PM5/21/13
to ruby-...@googlegroups.com
The route_param option was added on HEAD, hasn't been released yet (see https://github.com/intridea/grape/blob/master/CHANGELOG.md).

Point your grape to :git => "https://github.com/intridea/grape.git"

--
You received this message because you are subscribed to the Google Groups "Grape Framework Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-grape+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

dB. | Moscow - Geneva - Seattle - New York
dblock.org - @dblockdotorg - artsy.net

Maxwell Bernstein

unread,
May 21, 2013, 5:59:03 PM5/21/13
to ruby-...@googlegroups.com
Oh, perfect! Thank you :)


--
You received this message because you are subscribed to a topic in the Google Groups "Grape Framework Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ruby-grape/5kdv6SuNecA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ruby-grape+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Bitcoin: 1LoS14vVcJApd3Ku66S11DyhVsx1AmPjGR
Reply all
Reply to author
Forward
0 new messages