try `has_many :post_topics, :accessible => true`

Bryan


Leonardo Frittelli wrote:
> Dear Hobo wizards,
> 
> Yes, it's me again with another doubt :), this time related to 
> association classes.
> 
> Let's pretend that we have the following models and relationships:
> A blog Post has a many_to_many association with Topics  through 
> PostTopic. Now, PostTopic has an additional field "relevance", a 1-10 
> value that represents how relevant the Post is for the associated Topic.
> 
> Example:
> 
> Post A -> Politics (relevance: 8)
>                Economy (relevance: 5)
>                International Relations (relevance: 2)
> 
> Post B -> Economy (relevance: 10)
>                Politics (relevance: 3)
> 
> Hence, relevance is a field of the association class and not of any of 
> the other two.
> 
> I would like the user to be able to set the value to relevance while 
> editing a Post, if possible.
> I have noticed that the default form for Post does not provide this 
> feature.
> 
> What would be the Hobo recommended way to do this?
> 
> The models look like:
> 
> class Post < ActiveRecord::Base
>   hobo_model
>   ...
>   has_many :topics, :through => :post_topics
>   has_many :post_topics
>   ...
> end
> 
> class Topic < ActiveRecord::Base
>   hobo_model
>   ...
>   has_many :posts, :through => post_topics
>   has_many :post_topics
>   ...
> end
> 
> class PostTopic < ActiveRecord::Base
>   hobo_model
>   fields do
>         relevance :integer
>         timestamps
>   end
>   belongs_to :post
>   belongs_to :topic
>   ...
> end
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to