i''ve got a cool app going and it''s getting bigger and bigger, but now i''m trying to customize the show function. i''m using the scaffold code as a base but can''t seem to get anything to look right. i guess i''m confused about how exactly the scaffold code works for the "show" function. any help would be awesome! thanks. jon -- Posted via http://www.ruby-forum.com/.
Jon Mr wrote:> i''ve got a cool app going and it''s getting bigger and bigger, but now > i''m trying to customize the show function. i''m using the scaffold code > as a base but can''t seem to get anything to look right. i guess i''m > confused about how exactly the scaffold code works for the "show" > function. any help would be awesome! thanks. >What exactly are you trying to achieve? -- Alex
Alex Young wrote:> What exactly are you trying to achieve?it show''s too much information.. like this.... ========Monday: 1 Tuesday: 1 Wednesday: 1 Thursday: 1 Friday: 0 Saturday: 1 Sunday: 0 ======== i only want to display the ones that were checked. but i can''t get it to not display all of it. any suggestions? -- Posted via http://www.ruby-forum.com/.
Why don''t you set a :condition in your find() method to only return the ones where checked = 1? something like find(:all, :condition => "checked = 1") I don''t know if the syntax is exactly correct, but would that work? Ryan On 3/17/06, Jon Mr <jon.druse@gmail.com> wrote:> > Alex Young wrote: > > > What exactly are you trying to achieve? > > > it show''s too much information.. > like this.... > ========> Monday: 1 > > Tuesday: 1 > > Wednesday: 1 > > Thursday: 1 > > Friday: 0 > > Saturday: 1 > > Sunday: 0 > ========> > i only want to display the ones that were checked. but i can''t get it to > not display all of it. any suggestions? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ryan Prins rprins@gmail.com http://www.lazyi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060317/52d2a58d/attachment.html
Jon Mr wrote:> Alex Young wrote: > >> What exactly are you trying to achieve? > > > it show''s too much information.. > like this.... > ========> Monday: 1 > > Tuesday: 1 > > Wednesday: 1 > > Thursday: 1 > > Friday: 0 > > Saturday: 1 > > Sunday: 0 > ========> > i only want to display the ones that were checked. but i can''t get it to > not display all of it. any suggestions? >I presume from this that each weekday is represented as a column in your object table. In that case, rather than the current show code which looks like this: <% for column in ModelName.content_columns %> <p> <b><%= column.human_name %>:</b> <%=h @model_name.send(column.name %> </p> <% end %> you probably want to do something like: <% for column in ModelName.content_columns if @model_name.send(column.name) == 1 %> <p> <b><%= column.human_name %></b> </p> <% end end %> -- Alex