Forum: Ruby on Rails Components and layouts

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.
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-17 17:57
(Received via mailing list)
Is there anyway for a component to use the layouts availble to rest of
the app, but still use the templates under its own directory? Setting
the layout with a "layouts/admin" say, just produces "can not find
admin.rhtml...". Is there anyway around this?

If not I guess I could just put the views under app/views, but really
wanted to keep things seperate.

Thanks!
-Nick
93aea4ff5331ee2c926cebd8df6be579?d=identicon&s=25 Jm Mc (railsnewb)
on 2005-11-17 18:06
(Received via mailing list)
I try to call up images in my browser from my
public/images directory and get a routing error.

   Here is my path

http://localhost:3000/images/logo.jpg

   And the error

Routing Error

Recognition failed for "/images/logo.jpg"

Any ideas why this would be happening?
Fdc7ff1d176325ed86c81c7c4584f0ad?d=identicon&s=25 dmitry (Guest)
on 2005-11-17 21:26
(Received via mailing list)
On Thursday 17 November 2005 23:56, Nick Stuart wrote:
> Is there anyway for a component to use the layouts availble to rest
> of the app, but still use the templates under its own directory?
> Setting the layout with a "layouts/admin" say, just produces "can
> not find admin.rhtml...". Is there anyway around this?
>
> If not I guess I could just put the views under app/views, but
> really wanted to keep things seperate.
Can symlink be an easy way out?
Btw, I've tried to supply full path to layout method, like
"#{RAILS_ROOT}app/views/layouts/blah.rhtml" but with no success. I
wonder why so..
Fdc7ff1d176325ed86c81c7c4584f0ad?d=identicon&s=25 dmitry (Guest)
on 2005-11-17 21:41
(Received via mailing list)
On Friday 18 November 2005 00:04, jonathan Mcintire wrote:
>
> Recognition failed for "/images/logo.jpg"
>
> Any ideas why this would be happening?
Are you sure logo.jpg is in public/images? And make sure the
permissions are correct.
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-17 21:56
(Received via mailing list)
Symlinking wont work in this case, its gotta be deployable on a windows
box,
5565e460a42fbe5669b458b2753f8d34?d=identicon&s=25 Michael (Guest)
on 2005-11-17 23:10
I had a similar problem and turned out my path to the image was missing
a slash.

Example:

I had:

images/logo.gif

and Rails needed

/images/logo.gif

Not sure if it is the same for you or not, but you can give it a shot.
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-18 18:01
(Received via mailing list)
Not quite. All the stuff under /public is working fine and as it
should. My problem is that if I have views under
/components/my_component/comp/index.rhtml
It can't access a layout under /app/views/layouts/admin.rhtml

For now I've moved the views of the components under app/views but
this kind of defeats the purpose in my mind.

Any other ideas on this?

-Nick
96f97579d2aa7e2fd337c01f959fff92?d=identicon&s=25 luben.manolov (Guest)
on 2005-11-18 22:00
(Received via mailing list)
Hi Nick,

On 11/18/05, Nick Stuart <nicholas.stuart@gmail.com> wrote:
>
> Not quite. All the stuff under /public is working fine and as it
> should. My problem is that if I have views under
> /components/my_component/comp/index.rhtml
> It can't access a layout under /app/views/layouts/admin.rhtml
>
> For now I've moved the views of the components under app/views but
> this kind of defeats the purpose in my mind.
>
> Any other ideas on this?


I am using Subversion and I have solved this problem by using
"svn:external"
property to link components/layouts to /app/views/layouts. Not very
beautiful solution but works on Windows.

Best regards,

Luben
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-20 00:21
(Received via mailing list)
Interesting idea Luben. This might be the route I go, but it looks
like there is no 'offical' way to handle this. Guess I'll have open up
an enhancement request then...

Thanks again!
-Nick
This topic is locked and can not be replied to.