Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:53:33+00:00 2026-06-16T04:53:33+00:00

I’m working on a Hobo app trying to tie together a few models properly.

  • 0

I’m working on a Hobo app trying to tie together a few models properly.

Activity objects have many Page children. They also have many DataSet children.

Page objects have several different kinds of children. We’ll talk about Widget children, but there are several types with the same issue. An instance of a Widget belongs to a Page but also has a belongs_to relationship with a DataSet. Here’s the important point: the DataSet must belong to the containing Activity. So for any given @widget:

@widget.page.activity === @widget.data_set.activity

It’s easy enough to enforce this constraint in the model with a validation on save. The trick is presenting, within the Widget‘s form, a select menu of available DataSets which only contains DataSets for the current Activity

I was able to get this working for existing objects using a tag like this:

<data_set-tag: options="&DataSet.activity_is(&this.page.activity)" />

However, for a new Widget, this fails messily, because either &this or &this.page is not yet set. Even for a route which contains the page ID, like /pages/:page_id/widgets/new, I’m not really able to get an Activity to scope the list of DataSets with.

If this was proper Rails, I’d get in to the relevant controller method and make the Activity available to the view as @activity or something of the sort, but in Hobo the controllers seems to be 95% Magic™ and I don’t know where to start. The knowledge of which Activity is current must be in there somewhere; how do I get it out?

This is Hobo 1.3.x on Rails 3.0.x.


ETA: The code producing the errors is in the form tag for Widget, like so:

<extend tag="form" for="Widget">
  <old-form merge>
    <field-list: fields="&this.field_order">
      <data_set-tag: options="&DataSet.activity_is(&this.page.activity)" />
    </field-list>
  </old-form>
</extend>

As I said above, this works for editing existing Widgets, but not new Widgets; the error is undefined method 'page' for nil:NilClass. Bryan Larsen’s answer seems to suggest that &this.page should not be null.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:53:35+00:00Added an answer on June 16, 2026 at 4:53 am

    In the end, it turned out to be syntax. Instead of

    <data_set-tag: options="&DataSet.activity_is(&this.page.activity)" />
    

    I needed

    <data_set-tag: options="&DataSet.activity_is(@this.page.activity)" />
    

    (note the @).

    We actually made this into a helper method, so the final code is

    <data_set-tag: options="&DataSet.activity_is(activity_for(@this))" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.