<select-many> in 2.0.0 pre6 / bootstrap

80 views
Skip to first unread message

Jeremy Savoy

unread,
Nov 18, 2012, 4:56:55 PM11/18/12
to hobo...@googlegroups.com
Hi, I'm having trouble getting <select-many> to work in a new app using hobo 2.0.0 pre6 and bootstrap.

in my "foo" model I have ...

has_many :foo_assignments, :dependent => :destroy
  has_many :bars, :through => :foo_assignments

in my "foo_assignment" model I have ...

belongs_to :foo
belongs_to :bar

and in application.dryml I have ...

<extend tag="form" for="Foo">
  <old-form merge>
    <field-list: fields="foo1, foo2, bars">
      <bars-view:>
        <select-many/>
      </bars-view:>  
    </field-list:>
  </old-form>
</extend>

Each Foo can have many Bars, but each Bar can only belong to one Foo, so I haven't put anything relational in my Bars model -- was considerings "has_one" foo_assignments - that didn't make a difference for the select-many.

I'm assuming my errors are in application.dryml, but the code runs fine but the select-many never shows up. I'm sure it's something simple, any ideas ?

Bryan Larsen

unread,
Nov 18, 2012, 8:51:33 PM11/18/12
to hobo...@googlegroups.com
Try adding :accessible => true to your has_many and/or has many :through.

Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/9mdteBzAMDUJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

Jeremy Savoy

unread,
Nov 19, 2012, 11:47:59 AM11/19/12
to hobo...@googlegroups.com
Thanks Bryan, forgot that bit -- but still doesn't work. In fact, in application.dryml if I change 

<field-list: fields="foo1, foo2, bars">

to

<field-list: fields="foo1">

I still get my default fields for Foo -- foo1 and foo2 during a "new", but no bar obviously.

I have not tried this with the other themes, only bootstrap.

Ignacio Huerta

unread,
Nov 20, 2012, 2:58:49 PM11/20/12
to hobo...@googlegroups.com, Jeremy Savoy
Hi Jeremy,

I'm afraid I didn't understand your DB structure:

> Each Foo can have many Bars, but each Bar can only belong to one Foo

Don't you need here a one-to-many relationship (has_many / belongs_to)
instead of a many-to-many relationship?

Regards,
Ignacio

El 19/11/12 17:47, Jeremy Savoy escribi�:
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/_iskhz6nJ-kJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre

Jeremy Savoy

unread,
Dec 21, 2012, 11:23:23 AM12/21/12
to hobo...@googlegroups.com, Jeremy Savoy
Sorry for the delayed response. 

Yes, so in my bar model I have ...

belongs_to :foo_assignment

Completing the belongs_to/has_many relationship, and utilizing a backend model foo_assignment so that I can use :through and then be allowed to use <select-many>.

This still doesn't work for me in pre7.


On Tuesday, November 20, 2012 2:59:11 PM UTC-5, Ignacio Huerta wrote:
Hi Jeremy,

I'm afraid I didn't understand your DB structure:

> Each Foo can have many Bars, but each Bar can only belong to one Foo

Don't you need here a one-to-many relationship (has_many / belongs_to)
instead of a many-to-many relationship?

Regards,
Ignacio

El 19/11/12 17:47, Jeremy Savoy escribi�:
Tel�fono: 0034 645 70 77 35

Mike

unread,
Jan 6, 2014, 9:21:02 PM1/6/14
to hobo...@googlegroups.com, Jeremy Savoy
Jeremy, 

Did you ever get this to work?  I'm wondering what the issue was....

Mike

Ignacio Huerta

unread,
Jan 8, 2014, 11:33:15 AM1/8/14
to hobo...@googlegroups.com
Hi Mike,

I don't know if Jeremy found the solution, but it doesn't work because
with Rails 3/4 you need to make the relationship "accessible" twice:

has_many :foos, :accessible => true
attr_accessible :name, :description, :foos

Warm regards,
Ignacio

PS: Mike, if this doesn't help, please send us a piece of the failing
code so we can try to reproduce :).

El 07/01/14 03:21, Mike escribi�:
> Jeremy,
>
> Did you ever get this to work? I'm wondering what the issue was....
>
> Mike
>
> On Friday, December 21, 2012 11:23:23 AM UTC-5, Jeremy Savoy wrote:
>
> Sorry for the delayed response.
>
> Yes, so in my bar model I have ...
>
> belongs_to :foo_assignment
>
> Completing the belongs_to/has_many relationship, and utilizing a
> backend model foo_assignment so that I can use :through and then be
> allowed to use <select-many>.
>
> This still doesn't work for me in pre7.
>
> On Tuesday, November 20, 2012 2:59:11 PM UTC-5, Ignacio Huerta wrote:
>
> Hi Jeremy,
>
> I'm afraid I didn't understand your DB structure:
>
> > Each Foo can have many Bars, but each Bar can only belong to
> one Foo
>
> Don't you need here a one-to-many relationship (has_many /
> belongs_to)
> instead of a many-to-many relationship?
>
> Regards,
> Ignacio
>
> El 19/11/12 17:47, Jeremy Savoy escribi�:
> <https://groups.google.com/d/msg/hobousers/-/_iskhz6nJ-kJ>.
> > To post to this group, send email to hobo...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > hobousers+...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/hobousers?hl=en
> <http://groups.google.com/group/hobousers?hl=en>.
>
> --
> Ignacio Huerta Arteche
> http://www.ihuerta.net
> Tel�fono: 0034 645 70 77 35
> Email realizado con software libre
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35

Mike

unread,
Jan 9, 2014, 9:54:28 PM1/9/14
to hobo...@googlegroups.com
Makes perfect sense.  My problems are around the getting the jQuery events to work with my upgraded app (hobo v2)...I posted separately on it.  Definitely user error, but I'm stuck.


On Wednesday, January 8, 2014 11:33:15 AM UTC-5, Ignacio Huerta wrote:
Hi Mike,

I don't know if Jeremy found the solution, but it doesn't work because
with Rails 3/4 you need to make the relationship "accessible" twice:

  has_many :foos, :accessible => true
  attr_accessible :name, :description, :foos

Warm regards,
Ignacio

PS: Mike, if this doesn't help, please send us a piece of the failing
code so we can try to reproduce :).

El 07/01/14 03:21, Mike escribi�:
> Jeremy,
>
> Did you ever get this to work?  I'm wondering what the issue was....
>
> Mike
>
> On Friday, December 21, 2012 11:23:23 AM UTC-5, Jeremy Savoy wrote:
>
>     Sorry for the delayed response.
>
>     Yes, so in my bar model I have ...
>
>     belongs_to :foo_assignment
>
>     Completing the belongs_to/has_many relationship, and utilizing a
>     backend model foo_assignment so that I can use :through and then be
>     allowed to use <select-many>.
>
>     This still doesn't work for me in pre7.
>
>     On Tuesday, November 20, 2012 2:59:11 PM UTC-5, Ignacio Huerta wrote:
>
>         Hi Jeremy,
>
>         I'm afraid I didn't understand your DB structure:
>
>         > Each Foo can have many Bars, but each Bar can only belong to
>         one Foo
>
>         Don't you need here a one-to-many relationship (has_many /
>         belongs_to)
>         instead of a many-to-many relationship?
>
>         Regards,
>         Ignacio
>
>         El 19/11/12 17:47, Jeremy Savoy escribi�:
>         Tel�fono: 0034 645 70 77 35
>         Email realizado con software libre
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Reply all
Reply to author
Forward
0 new messages