Forum: Ruby on Rails site content blocks

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
830d7bc2490cf4050c64931581e290a6?d=identicon&s=25 torp (Guest)
on 2009-01-28 10:50
(Received via mailing list)
newbie question:

what is the best way in rails to make content managed data that isn't
iterated? eg. on a 'contact us' page i have an business address field
that the client needs to be able to update, and there are many other
fields on the site that need to be content managed.... should i create
one table that stores all this data and access it in the pages action?

i've created a table called 'blocks' which contains fields 'id',
'name' and 'content'

and in the controller

def contactus
     address = Block.find(:first, :conditions => { :name =>
"businessaddress"})
end

which i can then access from the view, except this seems cumbersome.

better ideas?
3d02b4f32fa6f82ed55b408e471bae55?d=identicon&s=25 Jean-Marc (M2i3.com) (Guest)
on 2009-01-28 16:07
(Received via mailing list)
How about creating a model (and a table) called contact
information....

You're code will be a lot cleaner and meaningfull.

usually compagnies have multiple contacts they like to make visible,
having a model for such purpose should provide good starting point and
allow for expension (like one business contact, the invoicing contact,
etc.)

Regards,

Jean-Marc
http://m2i3.com/
This topic is locked and can not be replied to.