开发者

Before_save: call url and return height of div

One of my models has a lot of dynamic content, and I would like to save the height of the element into the database. I was wondering if this would be possible by calling a url fro开发者_如何转开发m the model with wget and then return the height of the div.

Any suggestions?


I assume you are saving it to recreate the same height on the next view of the page? If so, it sounds like a job for CSS instead of storing a variable fixed height for a div.

If CSS doesn't solve your problems please provide some context for how you will be using the height data.


The height of a particular element is probably not something that is important to your data model. A more elegant solution would be just to use javascript in the view to calculate the height on each page load.

If the height is important to your data model, then the javascript var can be used to set a property of your object at load time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜