This works for my purpose!

@prose = Submission.find(:all, :include => :genre, :conditions => ["
genres.name = ?", "Prose"]

Now I just need to make sure they haven't posted a comment yet. Thank you
guys for all your assistance!

On Mon, Nov 9, 2009 at 11:23 PM, christian <[email protected]> wrote:

> Alright I hope I am posting the relevant information.
>
> Here is from my genre.rb (genre model file)
> *"class Genre < ActiveRecord::Base
>
>   hobo_model # Don't put anything above this
>
>   fields do
>     name :string
>     timestamps
>   end
>
>   has_many :submissions, :dependent => :destroy
>   has_many :users, :dependent => :destroy"*
>
> Since I intend to sort by submissions I will post the submissions.rb next.
>
> *"class Submission < ActiveRecord::Base
>
>   hobo_model # Don't put anything above this
>
>   fields do
>     title :string
>     body  :text
>     status :string, :default => false
>     timestamps
>   end
>
>   belongs_to :issue
>   belongs_to :genre"*
>
> Then I am trying to pull these submissions with the that belong to the
> genre prose on the user page for prose editors. I have already successfully
> set it up so that prose editors see only the table I am working on so now it
> is just a matter of trying to make it so they only see relevant submissions.
>
>
> So here is my user_controller.rb
> *
> "class UsersController < ApplicationController
>
>   hobo_user_controller
>
>   auto_actions :all, :except => [ :new, :create ]
>
>   def account
>
>         @prose = Submission.find(:all, :include => :genre, :conditions => [
> genre.name == '1' ])
>     hobo_show
>
>   end"*
>
> Then this data will be displayed in account.dryml
> *
> "<if test="&logged_in? && current_user.editor? && @user.editor?">
>
>     <h3>Pending Review</h3>
>         <br />
>
>
>        <table-plus with="&@prose" fields="issue, this, owner, genre,
> comments.count, judgements, created_at">
>
>            <created-at-view:><view format="%d %B %Y"/></created-at-view:>
>        <controls:>Report</controls:>
>          </table-plus>
>
>
>     </if>*"
>
> I hope this better explains what I am trying to accomplish. I feel if I can
> pull data and run conditions from other related models against it that I
> will have a much better grasp of how to deal with data using dryml/hobo. If
> you are curious I am trying to build my friend a submission manager for a
> literary magazine and teach myself hobo in the process.
>
> Thanks again for your time and patience.
>
>
> On Mon, Nov 9, 2009 at 11:11 PM, Matt Jones <[email protected]> wrote:
>
>>
>>
>> On Nov 9, 2009, at 5:45 PM, christian wrote:
>>
>> > Genre in my case is a seperate model which both user and submissions
>> > has many and I want to sort by submissions genre.
>> >
>> > Genre has many submissions and users. Submissions belong to genre.
>> >
>> > So for this example would it be?
>> >
>> > class Submission
>> >   named_scope :prose, :include => :genre, :conditions =>
>> > { :submissions =>
>> > { :genre => 'Prose' } }
>> > end
>> >
>>
>> That's not going to work - my examples assumed (since you were
>> referencing users.genre) that genre was a field (likely an
>> enum_string) that was defined on User.
>>
>> Can you post the relevant parts of your models, either here or in a
>> gist?
>>
>> > Thank you. I feel I already understand the process much better and I
>> > have been reading the linked tutorials which I am catching things
>> > that didn't quite make sense before.
>>
>> :) As rough as things sometimes are now, just imagine what it was like
>> back in the old 0.6 era; most of the documentation back then was "read
>> the source". Big thanks to everybody that's contributed recipes, docs,
>> or even just come on the list and said, "X doesn't make sense...".
>>
>> --Matt Jones
>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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