[Rails] Re: get DB data to rhtml file

2009-07-13 Thread Ar Chron
Mark Preston wrote: > > I got it to work by changing my method in the mystuff_controller to look > like this: > > require 'Mystuff' > > class MystuffController < ApplicationController > > def index > >@my = Mystuff.find( :all) > > end > end > > The only change was to ch

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 13, 12:55 am, Mark Preston wrote: > I got it to work by changing my method in the mystuff_controller to look > like this: > > require 'Mystuff' > > class MystuffController < ApplicationController > >     def index > >       �...@my =  Mystuff.find( :all) > >     end >   end > > The only

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Mark Preston wrote: > Frederick Cheung wrote: >> On Jul 13, 12:38�am, Mark Preston >> wrote: >>> � � � �...@my = �Mystuff.find( :all) >> This >> >>> Mystuff#index >>> <%me.each do |mr|%> >> >> and this need to match - the instance variables are copied over for >> you. >> >> Fred > > Fred than

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Frederick Cheung wrote: > On Jul 13, 12:38�am, Mark Preston > wrote: >> � � � �...@my = �Mystuff.find( :all) > This > >> Mystuff#index >> <%me.each do |mr|%> > > and this need to match - the instance variables are copied over for > you. > > Fred Fred thanks, I saw that and changed it, but sti

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Mark Preston wrote: > Matt Harrison wrote: >> Mark Preston wrote: escape nasties (if appropriate)) >>> >>> Extracted source (around line #2): >>> >>> 1: Mystuff#index >>> 2: <%mystuff.each do |mr|%> >>> 3: =mr.m1 >>> 4: <% end %> >>> >>> >>> HELP :) >> >> Ok, in the controller you are as

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 13, 12:38 am, Mark Preston wrote: >       �...@my =  Mystuff.find( :all) This > Mystuff#index > <%me.each do |mr|%> and this need to match - the instance variables are copied over for you. Fred --~--~-~--~~~---~--~~ You received this message because yo

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Matt Harrison wrote: > Mark Preston wrote: >>> escape nasties (if appropriate)) >> >> Extracted source (around line #2): >> >> 1: Mystuff#index >> 2: <%mystuff.each do |mr|%> >> 3: =mr.m1 >> 4: <% end %> >> >> >> HELP :) > > Ok, in the controller you are assigning @me to your find. Try: > >

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Matt Harrison
Mark Preston wrote: > Frederick Cheung wrote: >> On Jul 12, 11:47�pm, Mark Preston >> wrote: >>> Mystuff#index >>> <%mystuff.each do |mr|%> >>> mr.m1 >>> <% end %> >>> >> if you want to display the result of a ruby expression (eg one of your >> attributes) then you need to use <%= ... %> (don't f

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Matt Harrison
Mark Preston wrote: > I am trying to get data out of a database to my rhtml file. The files > look like this: > > Model > --- > mystuff.rb > > class Mystuff < ActiveRecord::Base > set_table_name "mytable" > set_primary_key "id" > end > > > Controllers > -- > > mystuff_cont

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Frederick Cheung wrote: > On Jul 12, 11:47�pm, Mark Preston > wrote: >> >> Mystuff#index >> <%mystuff.each do |mr|%> >> mr.m1 >> <% end %> >> > > if you want to display the result of a ruby expression (eg one of your > attributes) then you need to use <%= ... %> (don't forget to use h to > escap

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 12, 11:47 pm, Mark Preston wrote: > > Mystuff#index > <%mystuff.each do |mr|%> > mr.m1 > <% end %> > if you want to display the result of a ruby expression (eg one of your attributes) then you need to use <%= ... %> (don't forget to use h to escape nasties (if appropriate)) Fred > Than