Forum: Ruby on Rails fixrbconfig - does it work on intel macs?

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.
9503f3189c36607bd4f0a2e0ee1ce811?d=identicon&s=25 Oskar (Guest)
on 2006-03-18 22:28
I'm trying now to do "sudo fixrbconfig" in the terminal, and I get this:

/usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist.  This
probably means you haven't yet installed Xcode from the Tiger DVD.  You
won't be able to compile Ruby extensions without it. Please install it
then rerun this program.

I'm on an intel mac. Am I unable to use fixrbconfig?
9503f3189c36607bd4f0a2e0ee1ce811?d=identicon&s=25 Oskar (Guest)
on 2006-03-18 22:28
Oskar wrote:
> I'm trying now to do "sudo fixrbconfig" in the terminal, and I get this:
>
> /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist.  This
> probably means you haven't yet installed Xcode from the Tiger DVD.  You
> won't be able to compile Ruby extensions without it. Please install it
> then rerun this program.
>
> I'm on an intel mac. Am I unable to use fixrbconfig?

Oh, BTW, I HAVE installed Xcode.
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-18 23:01
(Received via mailing list)
I have a lovely web-application, under controller "Child", and would
like to "include" it in a page under another application having
controller "Parent."  The natural way to do this, I would have
thought, would be to incorporate it in one of Parent's views using
render_component, thus:

	<%= render_component :controller => "Child", :action => "foo" %>

-----

So far, so good.  The page appears to render wonderfully in the
parent app, just as I intended.  My problem is that internal links
and more important, Ajax urls on that page, generated by the view in
child/view/foo.rhtml comes from  code like the following:

	<%= link_to :action => "bar1" %>
....
	<%= form_remote_tag :url => { :action => "bar2"} . . .
....
	<%= link_to_remote :action => "bar2" %>

and the like.

-----

The links, when running from a call to "http://localhost:3000/child/
foo", properly generate links to the corresponding portions of Child,
generating urls like:

	child/bar1
	child/bar2
	child/bar3

but when running under Parent, using the "render_component" generates

	parent/bar1
	parent/bar2
	parent/bar3

which is not inconsistent with the documentation, but inconsistent
with my intent.  Particularly when trying to componentize an Ajax
application, this is a disappointing result, as I was hoping to
encapsulate the internal portions of, in this case, a form editor.

One solution, of course, is to simply rewrite the sub-app with every
link_to, form_remote_tag and link_to_remote having a hard-
coded :controller parm, but is that the Rails way?  Is there a
better, simpler way to accomplish what I desire?

Thanks for your time and thoughts.
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-18 23:10
(Received via mailing list)
if you want to have a hard-link that does not depend on external call,
you
would have hard-coded controller name

not sure why you don't like that idea
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-18 23:25
(Received via mailing list)
I can certainly do it, but it seems inelegant to me.  That's why I
asked the question.

Mostly, the code can't trivially be reused by adding to another
controller, or the controller can't be renamed without grep/changing
all the view code.  Clearly, that can be handled in a generator, but
I was wondering if there was a simpler way.
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-18 23:29
(Received via mailing list)
if you want to reuse the code you can use *controller_name* to get the
name
automatically
6c27f78ab0eee78732ae54e8b8718b84?d=identicon&s=25 David Felstead (Guest)
on 2006-03-19 01:35
(Received via mailing list)
I would imagine you need to change the 'powerpc-darwin8.0' bit in the
fixrbconfig.rb script to whatever the directory is called on intel mac
os x - perhaps something like 'x86-darwin8.0'.

Have a look in the /usr/lib/ruby/1.8 directory and see what the
architecture specific directory is called.

-DF
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-19 01:35
(Received via mailing list)
That certainly works, and gets me most of the way there.  Is that my
best alternative?
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-03-19 03:00
(Received via mailing list)
I reccomend to just bite the bullet and compile your own ruby. The
osx one is broken and even with the fixrbconfig script it is not a
very good ruby binary. I have had much better luck with self compiled
ruby. Here is a link to a script that will instal ruby from source
for you or you can look in it to get the steps:

http://nubyonrails.com/files/ru-ra-lim.sh.zip


-Ezra
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-19 19:07
(Received via mailing list)
That will work, but I still don't understand what is happening here.

While the link_to, form_remote_tag and link_to_remote routines all
use the CALLING controller, Parent, other code in the view, in
particular render commands use the CALLED component controller,
Child!  Isn't this behavior strange or inconsistent?  Why doesn't
urls generated from the child controller default to the child
controller rather than the parent, and if so, why wouldn't render
work the same way?   Is there any formal way for me to understand
Rails' behavior here?
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-19 19:49
(Received via mailing list)
This is just the way it is done, though not exactly like you said.

http://api.rubyonrails.com/classes/ActionControlle...
"When generating a new URL, missing values may be filled in from the
current
request's parameters."
Note, it says current request, not calling/called controller

Nothing stops you from overwriting this function and using your own
approach
66247570dbe0c350a165cdabc2769ba1?d=identicon&s=25 Paul Robinson (Guest)
on 2006-03-19 22:00
(Received via mailing list)
On 18 Mar 2006, at 21:28, Oskar wrote:

> I'm trying now to do "sudo fixrbconfig" in the terminal, and I get
> this:
>
> /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist.  This
> probably means you haven't yet installed Xcode from the Tiger DVD.
> You
> won't be able to compile Ruby extensions without it. Please install it
> then rerun this program.
>
> I'm on an intel mac. Am I unable to use fixrbconfig?

The clue is in the path it's looking for ruby.h - it's hard-coded for
looking in the powerpc-darwin8.0 directory, which I'm guessing won't
exist on an Intel architecture machine for obvious reasons. :-)

Try doing this on the command line

cd /usr/lib/ruby/1.8/
ln -s universal-darwin8.0/* powerpc-darwin8.0

Then try again. Hope that fixes it for you.

--
Paul Robinson
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-20 02:03
(Received via mailing list)
Thanks so very much.  I get it now, and it makes sense.

why do the render commands work differently?
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-20 08:38
(Received via mailing list)
rendering is completely different story and is based on actions not
controllers, therefore if you don't specify anything it will use current
action
Ff5b4846b93008ffb2161805fa00af5f?d=identicon&s=25 Andrew Greenberg (Guest)
on 2006-03-23 03:19
(Received via mailing list)
I am not sure I am being clear, based on your response.  Controller
parent has an action, say index, and index.rhtml, its view, includes
the following command:

	. . . .
	render_component :controller => "Child" :action => "foo"
	. . . .

and foo has a view including the following in views/child/foo.rhtml:

	. . . .
	link_remote_to :action => "bar1" . . .
	. . . .
	form_remote_tag :action => "bar2" . . .
	. . . .
	render :partial=>"bar3" . . .
	. . . .

The partial generates the partial specified in "shmoo.rhtml" in the
CHILD directory, but the link_remote_to generates a link to "http:/
mydomain.com/parent/bar1" and the form_remote_tag generates a call
upon submission to "http://mydomain.com/parent/bar2"

It still seems confusing to me, although I think I am beginning to
"feel" ok about it at end.
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-23 09:04
(Received via mailing list)
render partial will use current controller to locate template if you
don't
specify anything

when you get to render command, you are now in the "child" controller
because this is what you called by render_component

on the other hand, link_to and form_tag use current request instead of
current controller and this is where the difference comes from...

you will get used to this - default values are what you need most of the
time :-)
51a56a476cb6cd763549013330e3d630?d=identicon&s=25 TC (Guest)
on 2006-11-26 23:31
This works but you must remove the /* and you will more than likely need
to issue it as a super user.

so it should be:

 sudo ln -s universal-darwin8.0 powerpc-darwin8.0

great idea though!

Paul Robinson wrote:
> On 18 Mar 2006, at 21:28, Oskar wrote:
>
>> I'm trying now to do "sudo fixrbconfig" in the terminal, and I get
>> this:
>>
>> /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist.  This
>> probably means you haven't yet installed Xcode from the Tiger DVD.
>> You
>> won't be able to compile Ruby extensions without it. Please install it
>> then rerun this program.
>>
>> I'm on an intel mac. Am I unable to use fixrbconfig?
>
> The clue is in the path it's looking for ruby.h - it's hard-coded for
> looking in the powerpc-darwin8.0 directory, which I'm guessing won't
> exist on an Intel architecture machine for obvious reasons. :-)
>
> Try doing this on the command line
>
> cd /usr/lib/ruby/1.8/
> ln -s universal-darwin8.0/* powerpc-darwin8.0
>
> Then try again. Hope that fixes it for you.
>
> --
> Paul Robinson
This topic is locked and can not be replied to.