Re: getting "@attribute is not defined yet" trying to use base_params

2 views
Skip to first unread message

Josep Blanquer

unread,
Jul 25, 2016, 5:51:29 PM7/25/16
to jona...@peoplesized.com, praxis-support
All,

 I forgot to close the loop over email on this one (it was only posted on the support slack chat).
So, just for the record, this generated this issue: https://github.com/rightscale/praxis/issues/308


Which was merged to master July 5th.

Cheers,

Josep M.

On Tue, Jun 21, 2016 at 3:32 AM, <jona...@peoplesized.com> wrote:
Hi there,

I'd really appreciate some guidance!

We're trying to create an API that will serve similar content to multiple countries, and it looks like "base_params" would be a good place to include a ":country" param in the ApiDefinition. We've added "base_path" and "base_params" to the ApiDefinition, something like the example on http://praxis-framework.io/reference/api-definition/:

Praxis::ApiDefinition.define do

  info do
    base_path '/api/:country'

    base_params do
      attribute :country, String
    end

....


The application now won't load. It gives an error "RuntimeError: @attribute not defined yet for V1::MediaTypes::Risk". (This looks to come from "gems/praxis-0.20.1/lib/praxis/action_definition.rb:124:in `params'" where it's trying to merge '@params.attributes' before 'attributes' has been created? Using an empty 'base_params' block produces the same error, as does using the example from the Praxis docs above.)

Is there another step we need to take to get this to work?

We could use a trait instead, and pass the country in that way, but the base_params seems better.

Thanks for taking a look!
Jonathan

--
You received this message because you are subscribed to the Google Groups "praxis-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to praxis-suppor...@googlegroups.com.
To post to this group, send email to praxis-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/praxis-support/1f2aacd0-e5f9-4cb7-973e-ffe390854de1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages