Forum: Ruby on Rails http://127.0.0.1:3000/

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.
Anil V. (Guest)
on 2006-02-16 10:29
Hi,

I installed ruby on rail on my windows system.
I sucessfully made one database related application.
But when i want to execute it, i have to give url like
http://127.0.0.1:3000/wedding/ etc.
can't i browse through my browser?
192.168.0.51 is my ip.
Another one thing is i never get file named new in my example then also
it executes file called new for database inserting ,how it is?

please tell,i confused
David M. (Guest)
on 2006-02-16 10:46
(Received via mailing list)
If you try http://192.168.0.51:3000/wedding/..., you should find you
(and others on your network) can get to your app OK.

If you've created scaffolds, you'll find that there's a "new" method
created in your controller automatically.

Regards

Dave M.
Anil V. (Guest)
on 2006-02-16 10:57
Hi,
Thank You David.
I tried what you told & i solved my problem.

I understand if i create scaffolds method then "new" is automatically
there.
But now my query is this,if i want the "new" page in different
format(i.e suppose i want all matter on page in center)then how i?
David M. (Guest)
on 2006-02-16 11:16
(Received via mailing list)
If your model is named "users", then you'll find there's two files
that render the "new" page for your users table:
- app/view/users/new.rhtml
- app/view/users/_form.rhtml

When you render the "new" page of your application, the _form.rhtml
content is "embedded within" the new.rhtml content.  Check both of
those files out, and it should become clear how they tie together.

You can change the content of either or both of these two files, and
it will alter the appearance of your "new" page.  Also, you can change
the public/stylesheets/scaffold.css file to influence how your "new"
page gets rendered.

By the way, the _form.rhtml file is also used in the "update" page of
your application, so if you change it bear in mind that your changes
will appear on both of those screens.

If you work through one of the free Rails tutorials on the Web, all
this will probably become clearer.  "Rolling with Ruby on Rails" is
the best one I found when I was starting out, but there's now plenty
of others around as well.

Good luck

Dave M.
Anil V. (Guest)
on 2006-02-16 12:33
Hi,

I found new.rhtml file.But it is in
c:\ruby\lib\ruby\gems\1.8\gems\actionpack-1.11.2\lib\actioncontroller\
template\scaffolds\new.rhtml

In this file there is this code.

<h1>New <%= @scaffold_singular_name %></h1>

<%= error_messages_for(@scaffold_singular_name) %>

<%= form(@scaffold_singular_name, :action =>
"create#{@scaffold_suffix}") %>

<%= link_to "List", :action => "list#{@scaffold_suffix}" %>

I cant found _form.rhtml

<%= form(@scaffold_singular_name, :action =>
"create#{@scaffold_suffix}") %> this code is related with displaying
form.
How could i make changes in it?
Where is the code for text boxes and create(submit) button.
David M. (Guest)
on 2006-02-16 12:59
(Received via mailing list)
No, the new.rhtml file you've found is a template that's used to
generate the new.rhtml file for your application.  If you've generated
scaffolds, you should find one new.rhtml per scaffold in the directory
'app/view/TABLENAME/ directory.

Try working through one of the online tutorials as I suggested
earlier, and it should become clearer.

Regards

Dave M.
Anil V. (Guest)
on 2006-02-16 15:20
Hi Dave,

I successfully solved all problem & now i can run my project without
bugs.

Thank you very much for you help!
what happend know,your suggested tutorial,i was trying from earlier but
problem is that i not studied full tutorial(that means part 2).


Thank you once again.
Hopeful for your help in future.

Bye...
This topic is locked and can not be replied to.