1 Replies - 12925 Views - Last Post: 06 August 2011 - 11:56 AM Rate Topic: -----

#1 NotarySojac   User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Rails - a view based on the contents of another partial?

Posted 06 August 2011 - 09:48 AM

Can you generate an html based on the contents of another partial, such as _partners_slideup.html.erb.

I'm thinking of making it so there's a db table containing all the literature for a few things. I was thinking that I would have an "Edit Literature" page, and then let the administrator write/edit literature paragraphs. Then, via dropdown menus, they could connect the literature to named elements with in the partial.

Say, for every element in the partial _partners_slideup.html.erb that is of the class needs-lit, make that an option in the dropdown menu for ascribing the literature to an element. Then, perhaps in the controller, all of the literature is pulled out of the database and set to be the content for the element it is ascribed to.

I'm almost brand new to rails, but this would be SO SWEET if rails has this capacity.

This post has been edited by NotarySojac: 06 August 2011 - 09:51 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Rails - a view based on the contents of another partial?

#2 NotarySojac   User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Rails - a view based on the contents of another partial?

Posted 06 August 2011 - 11:56 AM

I found a better way: to generate both views based on instance variables from the controller (pulling their data from the database). *doh*
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1