Forum: Ruby how to increase the width of a field in rails

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.
anansi (Guest)
on 2007-05-02 21:40
(Received via mailing list)
Hi,
when I created a scaffold for the input of some data ,the following was
created as new.rhtml:

<h1>New entry</h1>

<% form_tag :action => 'create' do %>
   <%= render :partial => 'form' %>
   <%= submit_tag "Create" %>
<% end %>

<%= link_to 'Back', :action => 'list' %>

this is the view which shows the following:
http://img115.imageshack.us/img115/9167/neentryco1.jpg

this is my class Entry:

class Entry < ActiveRecord::Base

   def self.show_items
     find(:all,
          :conditions => "date_available <= now()",
          :order      => "date_available desc")
   end

  validates_presence_of :headline,:news
  validates_uniqueness_of :headline, :news
end

and this are the important lines from the corresponding controller:

  def new
     @entry = Entry.new
   end

   def create
     @entry = Entry.new(params[:entry])
     if @entry.save
       flash[:notice] = 'Entry was successfully created.'
       redirect_to :action => 'list'
     else
       render :action => 'new'
     end
   end

where do I have to make the changes for the display. I want to give the
"News" field you can see on the screenshot more width but dunno how to
do.



--
greets

                            (
                            )
                         (
                  /\  .-"""-.  /\
                 //\\/  ,,,  \//\\
                 |/\| ,;;;;;, |/\|
                 //\\\;-"""-;///\\
                //  \/   .   \/  \\
               (| ,-_| \ | / |_-, |)
                 //`__\.-.-./__`\\
                // /.-(() ())-.\ \\
               (\ |)   '---'   (| /)
                ` (|           |) `
          jgs     \)           (/


one must still have chaos in oneself to be able to give birth to a
dancing star
Leslie V. (Guest)
on 2007-05-02 23:51
(Received via mailing list)
On 5/2/07, anansi <removed_email_address@domain.invalid> wrote:
>
> Hi,
> when I created a scaffold for the input of some data ,the following was
> created as new.rhtml:
>
> <h1>New entry</h1>
>
> <% form_tag :action => 'create' do %>
>    <%= render :partial => 'form' %>



You need to look in the 'form' partial (_form.rhtml). Find the 'news'
field
and add a :cols=>40 or whatever.
Here's the full text_area syntax:

text_area("post", "body", "cols" => 20, "rows" => 40)


..which I got from http://api.rubyonrails.com.
For any Rails work, I highly recommend the book "Agile Web D.
with
Rails"


Les
come (Guest)
on 2007-05-03 11:56
(Received via mailing list)
Hi,

It's a quite basic question about rails.. Are you sure you shouldn't
read a book about rails ;-) ?
Moreover, I'm not sure it is the right goup to post about rails, too.

In your view new.rhtml, you have this instruction :

<%= render :partial => 'form' %>

That means you have a "sub-view" named "_form.rhtml".
In this sub view, you should find a line like this :

<%= text_area 'entry', 'news'  %></p>

You could add options to this line like ":cols => nnn" and ":row =>
nnn" to increase the size of this forms area.
Chris C. (Guest)
on 2007-05-03 15:59
(Received via mailing list)
On 5/2/07, anansi <removed_email_address@domain.invalid> wrote:
>
>      find(:all,
>   def new
>      end
>                                         (
>                                  (\ |)   '---'   (| /)
>                                   ` (|           |) `
>                             jgs     \)           (/
>
>
> one must still have chaos in oneself to be able to give birth to a
> dancing star
>
>

Hi anansi, I cannot help but notice that you have been asking a
considerable number of Rails questions on the Ruby list.  There is
another list setup by the rails people for questions relating
specifically to rails.  We prefer people ask rails questions on that
list, because there is a higher chance of getting a proper answer from
all those rails people.  You wouldn't ask a Ruby question on a C
newsgroup because ruby is implemented in C.

http://groups.google.com/group/rubyonrails-talk

Unfortunately they do not have a Usenet gateway like we do, so you
will have to bite and use the web interface.

Welcome to Ruby!
anansi (Guest)
on 2007-05-03 18:30
(Received via mailing list)
Chris C. wrote:
> Unfortunately they do not have a Usenet gateway like we do, so you
> will have to bite and use the web interface.
>
> Welcome to Ruby!
Hi Chris,
well first of all I didn't knew that this newsgroup is limited to just
some aspects of ruby, maybe you should do some white- or black-listing
on topics if you think mine wouldn't fit here.
But every question I droped was answered here very fast and correclty
because as I thought it is obvious that many ppl who uses the Rails
framework also suscribed to the ruby-list.

And about the rails (not mailing- and not newsgroup) but google.group:
you really think it's clever to be forced to register (when I wanna sign
up to this list I always get: "You must sign in to Google to complete
the previous action.") to one of the greatest commercial companys on the
planet in order to get knowledge about one of the most free programming
languages on the planet? I don't think so ;)

I mean, I'm sure you also realized that ruby never succeded in the step
to spread his information over http and any good forums or websites
about ruby are more rare than unicorns... so please let me this
newsgroup because it kicks ass :)



--
greets

                            (
                            )
                         (
                  /\  .-"""-.  /\
                 //\\/  ,,,  \//\\
                 |/\| ,;;;;;, |/\|
                 //\\\;-"""-;///\\
                //  \/   .   \/  \\
               (| ,-_| \ | / |_-, |)
                 //`__\.-.-./__`\\
                // /.-(() ())-.\ \\
               (\ |)   '---'   (| /)
                ` (|           |) `
          jgs     \)           (/


one must still have chaos in oneself to be able to give birth to a
dancing star
anansi (Guest)
on 2007-05-03 18:32
(Received via mailing list)
first thanks for your answer, it worked great :)

but do you know a cheat sheet or a summary of rails objects and their
methods because this is my _form.rhtml:

<%= error_messages_for 'entry' %>

<!--[form:entry]-->
<p><label for="entry_headline">Headline</label><br/>
<%= text_field 'entry', 'headline'  %></p>

<p><label for="entry_news">News</label><br/>
<%= text_area 'entry', 'news',:cols => 100 %></p>

<p><label for="entry_date_available">Date available</label><br/>
<%= datetime_select 'entry', 'date_available'%></p>
<!--[eoform:entry]-->


you see ,:cols => 100 works nicely for text_area but not for text_field
above... is there a list of these objects or classes and their methods?




--
greets

                            (
                            )
                         (
                  /\  .-"""-.  /\
                 //\\/  ,,,  \//\\
                 |/\| ,;;;;;, |/\|
                 //\\\;-"""-;///\\
                //  \/   .   \/  \\
               (| ,-_| \ | / |_-, |)
                 //`__\.-.-./__`\\
                // /.-(() ())-.\ \\
               (\ |)   '---'   (| /)
                ` (|           |) `
          jgs     \)           (/


one must still have chaos in oneself to be able to give birth to a
dancing star
Rick D. (Guest)
on 2007-05-03 18:57
(Received via mailing list)
On 5/3/07, anansi <removed_email_address@domain.invalid> wrote:

> well first of all I didn't knew that this newsgroup is limited to just
> some aspects of ruby, maybe you should do some white- or black-listing
> on topics if you think mine wouldn't fit here.
> But every question I droped was answered here very fast and correclty
> because as I thought it is obvious that many ppl who uses the Rails
> framework also suscribed to the ruby-list.

This may be, but in general, you'll find more rails expertise on the
rails group.  I've seen lots of rails-related questions go unanswered
here because no one with the right rails knowledge saw it.

> And about the rails (not mailing- and not newsgroup) but google.group:
> you really think it's clever to be forced to register (when I wanna sign
> up to this list I always get: "You must sign in to Google to complete
> the previous action.") to one of the greatest commercial companys on the
> planet in order to get knowledge about one of the most free programming
> languages on the planet? I don't think so ;)

That's a question for the rails community rather than the general ruby
community, and even though it might be a catch-22 situation, the ruby
list is where it should be raised.

> I mean, I'm sure you also realized that ruby never succeded in the step
> to spread his information over http and any good forums or websites
> about ruby are more rare than unicorns...

Hmm, you must not be looking very hard.  I've got about 50 different
Ruby oriented blogs in the list of rss feeds I look at.  You might
also want to use resources like del.icio.us.
http://del.icio.us/popular/ruby

And my most valuable tool in finding information about ruby, or
anything else is http://www.google.com although again for you that
might be a catch-22.

This isn't directed at you personally, but a lot of questions get
asked here and on other fora which exhibit evidence that the
questioner hasn't done his homework before asking the question.
Questions are much more likely to get answered if the question shows
that the questioner has tried to solve the problem himself first, and
gives clear context information about where he's gotten stuck.

Of course this is just reiterating part of the canonical exposition on
how to ask smart questions:
http://www.catb.org/~esr/faqs/smart-questions.html

> so please let me this
> newsgroup because it kicks ass :)

No one says you can't, just don't be surprised if you don't get all of
your rails questions answered, and occasionally get a response which
suggests checking the rails group.

Again quoting ESR:

"Know what your topic is! One of the classic mistakes is asking
questions about the Unix or Windows programming interface in a forum
devoted to a language or library or tool portable across both. If you
don't understand why this is a blunder, you'd be best off not asking
any questions at all until you get it."
http://www.catb.org/~esr/faqs/smart-questions.html#forum

This seems to map directly to asking about rails in a ruby-language
forum.  If this were a more typical usenet technical forum you might
get treated much more rudely.

Luckily , for all of us, ruby-lang seems to be one of the more genteel
forums on the "interwebs".


--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
anansi (Guest)
on 2007-05-03 19:30
(Received via mailing list)
@Rick DeNatale :
First, thx for this really great delicious link. Second, of course it is
obvious that I would get more answers on a rails list but as said: at
least at the moment I see absolutly no need to sign-up with google just
to get an answer I can simply get here.

I also don't think it as spamming as your posting sounds like because
that's a ruby-list and all my question are strictly and only related to
ruby and no other programming language so posting in a C group would be
totally different...

And the rest I don't get right: you think I'm posting here if I would
see a better or faster way to get the same information by myself?!?
makes not much sense.. at least in my eyes...

And you can be sure I penetrated google before I'm asking here. I mean
now that I know that text_area is affected in this issue it is easy to
find the right answer with google but try to find it without this
keyword... I didn't succeed so I asked here, got an answer and that's
it. Next time I don't have to ask how to change these views because now
I know the meaning of render :partial =>...  Before come's answer here I
didn't even expect it to have something to do with my issue.

I really don't get why some ppl are now feeling pissed of by me...


> rails group.  I've seen lots of rails-related questions go unanswered
> community, and even though it might be a catch-22 situation, the ruby
>
>
>
> forum.  If this were a more typical usenet technical forum you might
> get treated much more rudely.
>
> Luckily , for all of us, ruby-lang seems to be one of the more genteel
> forums on the "interwebs".
>
>


--
greets

                            (
                            )
                         (
                  /\  .-"""-.  /\
                 //\\/  ,,,  \//\\
                 |/\| ,;;;;;, |/\|
                 //\\\;-"""-;///\\
                //  \/   .   \/  \\
               (| ,-_| \ | / |_-, |)
                 //`__\.-.-./__`\\
                // /.-(() ())-.\ \\
               (\ |)   '---'   (| /)
                ` (|           |) `
          jgs     \)           (/


one must still have chaos in oneself to be able to give birth to a
dancing star
unknown (Guest)
on 2007-05-03 19:43
(Received via mailing list)
In message <f1cuts$jrj$removed_email_address@domain.invalid>, anansi writes:
>First, thx for this really great delicious link. Second, of course it is
>obvious that I would get more answers on a rails list but as said: at
>least at the moment I see absolutly no need to sign-up with google just
>to get an answer I can simply get here.

Welcome to the list of people whose questions I will never answer.

-s
Phillip G. (Guest)
on 2007-05-03 19:49
(Received via mailing list)
Peter S. wrote:
>
> Welcome to the list of people whose questions I will never answer.

"In /dev/null, nobody hears you post."

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #33:

Don't waste time on writing test cases and test scripts - your users are
your best testers.
Rick D. (Guest)
on 2007-05-03 22:15
(Received via mailing list)
On 5/3/07, Peter S. <removed_email_address@domain.invalid> wrote:
> In message <f1cuts$jrj$removed_email_address@domain.invalid>, anansi writes:
> >First, thx for this really great delicious link. Second, of course it is
> >obvious that I would get more answers on a rails list but as said: at
> >least at the moment I see absolutly no need to sign-up with google just
> >to get an answer I can simply get here.
>
> Welcome to the list of people whose questions I will never answer.

Hmmmm,

I guess I'll have to brush up on my biology, I thought that this was
supposed to be a spider:

                                       (
                                           )
                                          (
                                   /\  .-"""-.  /\
                                  //\\/  ,,,  \//\\
                                  |/\| ,;;;;;, |/\|
                                  //\\\;-"""-;///\\
                                 //  \/   .   \/  \\
                                (| ,-_| \ | / |_-, |)
                                  //`__\.-.-./__`\\
                                 // /.-(() ())-.\ \\
                                (\ |)   '---'   (| /)
                                 ` (|           |) `
                           jgs     \)           (/

But it seems to be a leech instead.

---
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
anansi (Guest)
on 2007-05-03 22:25
(Received via mailing list)
> But it seems to be a leech instead.

if you think so plz ignore me...

--
greets

                            (
                            )
                         (
                  /\  .-"""-.  /\
                 //\\/  ,,,  \//\\
                 |/\| ,;;;;;, |/\|
                 //\\\;-"""-;///\\
                //  \/   .   \/  \\
               (| ,-_| \ | / |_-, |)
                 //`__\.-.-./__`\\
                // /.-(() ())-.\ \\
               (\ |)   '---'   (| /)
                ` (|           |) `
          jgs     \)           (/


one must still have chaos in oneself to be able to give birth to a
dancing star
James B. (Guest)
on 2007-05-03 22:37
(Received via mailing list)
Rick DeNatale wrote:
> rails group.  I've seen lots of rails-related questions go unanswered
> here because no one with the right rails knowledge saw it.

More generally, people are asked to direct library-specific questions to
  their specific lists or forums because there are many, many Ruby
libraries and apps.

It may be simplest for you to post Rails questions to the general Ruby
list, but the same holds true for people with questions abut Nitro,
Mechanize, Mongrel, RedCloth, Capistrano, and so on.  If people are
freely asking and answering Rails-specific questions here, I would
expect other people to feel, quite understandably, entitled to ask their
own library-specific questions here as well.  And everyone loses in the
end because of the noise level.  There's a *reason* for these other
lists.

There is not always a clear line as to when a question belongs on one
list or another, but for the most part, if a list or group exists for an
app or library, that's the place to try first.  I empathize with people
who have trouble getting help on other lists, but only to the extent
they've shown good faith in trying to do it the right way first.

While I'm disappointed (but, sadly, not too surprised) at the tone of
some people who responded to you, they are ultimately correct.

You'll win no friends here by complaining about having to use Google
groups in order to learn Rails.

--
James B.

"In Ruby, no one cares who your parents were, all they care
  about is if you know  what you are talking about."
   - Logan C.
Leslie V. (Guest)
on 2007-05-04 18:08
(Received via mailing list)
>
>
> You'll win no friends here by complaining about having to use Google
> groups in order to learn Rails.



I usually just answer when I think I can, but maybe there should be some
kind of OT rule?

Though Ruby-talk *did* break my previous mail server, I've had no
problems
since moving it to Gmail; 9600 threads going strong! But I would have to
unsubscribe if I used anything else, so maybe a rule/guideline is in
order?
(don't want RubyTalk to get all police-state)

Also, there should really be a proper Rails list that doesn't require a
sign-up. I also hate adding new passwords to my 80-line-strong password
list. Perhaps the OP or someone else can organize this.

Les
helo (Guest)
on 2007-05-15 17:57
(Received via mailing list)
On May 3, 5:30 pm, anansi <removed_email_address@domain.invalid> wrote:
> @Rick DeNatale :
> First, thx for this really great delicious link. Second, of course it is
> obvious that I would get more answers on a rails list but as said: at
> least at the moment I see absolutly no need to sign-up with google just
> to get an answer I can simply get here.

if you so terribly mind signing up with google to follow the rails
group, maybe you should consider the rubyonrails channel on
irc:freenode.net...
Gregory B. (Guest)
on 2007-05-15 18:11
(Received via mailing list)
On 5/2/07, anansi <removed_email_address@domain.invalid> wrote:

>                                    //`__\.-.-./__`\\
>                                   // /.-(() ())-.\ \\
>                                  (\ |)   '---'   (| /)
>                                   ` (|           |) `
>                             jgs     \)           (/
>

This is such useful content!
This topic is locked and can not be replied to.