473,668 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New to ruby (easy question i think)

6 New Member
Hello I am new at ruby on rails and have what i hope is a simple question. Say I have a DB with animal names and an id. I am using active scaffold. once I click on the edit to edit any animal name how can i then access that that name in the view? I want to be able to output it in the textbox name: as well as just display it below the textbox that active scaffold creates.

Thanks for the help
Oct 4 '07 #1
1 2237
asrinivas1234
4 New Member
Hello I am new at ruby on rails and have what i hope is a simple question. Say I have a DB with animal names and an id. I am using active scaffold. once I click on the edit to edit any animal name how can i then access that that name in the view? I want to be able to output it in the textbox name: as well as just display it below the textbox that active scaffold creates.

Thanks for the help
............... ....
u have to pass the id for the particular selected animal..

how can u do it?

in first page, u r displaying the animals right?
how do u display animals?
u r fetching from database in controller and assigning that object and inside the .rhtml page, u r catching that object and iterating that object and displaying the animals.
Ex:
in controller-->
@animals = Animal.find :all

inside view,
<%for animal in @animals%>
<% form_tag :action => 'edit', :id => animal.id do %>


<%end%>
<%= submit_tag 'edit' %>

have u seen the form statement,
:id => animal.id.

then, inside ur controllers edit method,
def edit
@animal = Animal.find(par ams[:id])
end

then,
inside ur 2nd rhtml page,
u can use @animal and print the corresponding data...

if u have doubt,
u can mail me, --> avasarala.asrin ivas@gmail.com
Dec 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3061
by: Useko Netsumi | last post by:
or perhaps Java for developing web application? I've develop a few applications using PHP/MySQL/Apache and its growing in size. After reading the Ruby tutorial, and do a simple script, I kind of like this ease of use and a much cleaner language. But I have reservation about its viability as a dominant web programming language/tools. As with PHP, everywhere you look its PHP, perhaps it has extensive bell and whistles for web programmers...
54
6545
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
13
2701
by: Wayne Folta | last post by:
I've been a long-time Perl programmer, though I've not used a boatload of packages nor much of the tacky OO. A couple of years ago, I decided to look into Python and Ruby. Python looked OK, but not that different. I did like the indent-as-group idea, which was different. Ruby looked very cool. But it was impossible to get good documentation. It seemed like a Japanese cult with a few western initiates. Well, MacOS X ships with Perl,...
5
1762
by: F Jamitzky | last post by:
It is rather easy to define functions in python that mimic the special ruby syntactic sugar like: 5.times { print "Hello World!" } or .each { |food| eat food } In python these fragments can be written as:
5
1538
by: Ville Vainio | last post by:
I participated in a short thread on c.l.ruby, and had myself convinced that "blocks" might be a good idea. For bragging rights, if nothing else :). What I'm talking about is: <callable> block : suite
65
5505
by: Amol Vaidya | last post by:
Hi. I am interested in learning a new programming language, and have been debating whether to learn Ruby or Python. How do these compare and contrast with one another, and what advantages does one language provide over the other? I would like to consider as many opinions as I can on this matter before I start studying either language in depth. Any help/comments are greatly appreciated. Thanks in advance for your help.
5
2328
by: Matias | last post by:
I'm not asking if it's better or not than php... I want to know the opinions of web developers about this new toy... Byee..
28
2984
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. Ruby has ... an issue with docs. That is to say, there are almost none. Well, actually, there are some. For example, the "PickAxe" book (google it), and "Why's" Poignant Guide. But there's a disturbing lack of *built-in* docs for Ruby. Now, the...
10
3780
by: lawrence k | last post by:
I work mostly in PHP, but at the web design firm where I work we are thinking of switching to Ruby on Rails. Our lead designer recently installed Typo on a client's site and he said to us, with surprise, "All Ruby On Rails software has the same directory layout?" That was a revelation to him. He was used to the PHP scene, where diversity is the rule. I've done some google searches and I see that the subject has seen a fair amount of...
9
2307
by: Erwin Moller | last post by:
Hi Group, This may seem a odd question in a PHP group, but I think this might be a good place to ask since I am mainly a PHP coder these days that maybe starts with Ruby. Situation: A client of a friend of mine asked me to take over a project done in Ruby. (The original programmer appearantly behaved like an @ss and his client wants to get rid of him.)
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.