Fixrbconfig - does it work on intel macs?

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?

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.

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.

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

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.

if you want to reuse the code you can use controller_name to get the
name
automatically

That certainly works, and gets me most of the way there. Is that my
best alternative?

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

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

This is just the way it is done, though not exactly like you said.

http://api.rubyonrails.com/classes/ActionController/Base.html#M000174
“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

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. :slight_smile:

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 R.

Thanks so very much. I get it now, and it makes sense.

why do the render commands work differently?

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?

rendering is completely different story and is based on actions not
controllers, therefore if you don’t specify anything it will use current
action

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 :slight_smile:

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.

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 R. 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. :slight_smile:

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 R.