[Rails] tamil unicode support rails with mysql

2010-05-01 Thread nirosh
i have a problem with mysql.
 i have developed an app witch is works on unicode based. everything
worked so far.

now i migrate the db sqlite3 to mysql then my Unicode characters
appear as .

any idea to solve this problem.

nirosh

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] tamil unicode support rails with mysql

2010-05-01 Thread Amala Singh
Nirosh,

How do you migrate sqlite3 to mysql?

Please ensure that your migration is correct. When you export database into
files
you need to ensure that the file format is utf compatible. If it is ASCII
compatible
it wont work

Before you import the data into mysql, view the import script into a utf8
compatible
editor and see that you tamil characters are visible.

Then make sure that mysql engine is utf8 enabled. Columns defined are
utf8 compatible columns.

Cheers
Amala Singh

On 1 May 2010 08:45, nirosh kunalan.kand...@gmail.com wrote:

 i have a problem with mysql.
  i have developed an app witch is works on unicode based. everything
 worked so far.

 now i migrate the db sqlite3 to mysql then my Unicode characters
 appear as .

 any idea to solve this problem.

 nirosh

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.




-- 
-- 
Nandri(Thanks in Tamil),
Amala Singh

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Nested Forms with belongs_to association

2010-05-01 Thread Mlle
You should probably have the Person have an Address, that way you can
nest the Address creation form within your Person form.
Logically, you shouldn't nest the form of an Address within a Person
form since it's the Address that owns the Person according to your
current model...

On Apr 29, 2:18 pm, Sereno Mendes li...@ruby-forum.com wrote:
 Hi all,

 I have a relationship in this form: A person belongs to an address and a
 address can have many persons like below:

 class Person  ActiveRecord::Base
   belongs_to :address
 end

 class Address  ActiveRecord::Base
   has_many: persons
 end

 The ideia behind this is, if two or more persons share the same address,
 isn't necessary create two indetical rows in the database. But, like i'm
 new in the rails development, i want to create a form for person
 creation and edition that wraps the creation of related address, as a
 nested form. I already made a search for a solution for this problem,
 but the solutions that i found in others sites are for the inverse
 associations, any idea?

 Thanks.
 --
 Posted viahttp://www.ruby-forum.com/.

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Rails 3's rails.js should offer Ajax.Updater

2010-05-01 Thread funkensturm
Hey,

I have a form on a website that I would like to be submitted remotely
- to not have to reload the whole page. Only the form should update,
so that e.g. error messages can be displayed. Makes sense :)

However, with the current rails.js javascript in Rails 3, the only way
to do this is using

form_for ...  :remote = true

and then render a RJS in the controller, which will do... what? Try to
puzzle the form values and error messages into the invalid form?

Instead, I came up with this spontaneous extension to rails.js:
http://gist.github.com/385167

With something as easy as

form_tag ... :html = { 'data-update' =
'div_with_the_form_to_be_updated' }

I can now have the controller render HTML to update the form when it
has errors, and still RJS if I would like to do some fancy stuff in
case the submission was successful.

I assume this feature should be included in rails.js. It would take
just a few lines of smart modification.

In the far future, ActionView might even be modified to implement the
good ol'

form_tag ... :update = 'div_to_be_updated'

I would love to hear your opinion about this.
All the best!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: undefined method `call' for nil:NilClass

2010-05-01 Thread funkensturm
I think only two lines could cause this

     @echantillon.set_eros_values

       if @echantillon.save

Which line does it say the error comes from in your output?

You could write some

Rails.logger.debug Hi, this is the current status:
#...@echantillon.inspect}

between every line and then watch your logs/development.log to see
where exactly it breaks.

I would guess on set_eros_values (whatever that function is supposed
to do :)

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] sh: irb: command not found error

2010-05-01 Thread toulon
I am running ruby 1.8.6 and rails 2.3.5 and just started learning
rails

When following the tutorial on 
http://guides.rubyonrails.org/getting_started.html
I tried to run the command script/console and it failed.  After some
research I found the following solution.

I am posting this as my google search did not turn up any useful on my
initial scan

Anyway here goes for what it is worth

$ script/console
Loading development environment (Rails 2.3.5)
sh: irb: command not found

How to recompile ruby with readline support - this solves the irb
issue above

   1. Install readline to /usr/local
   2. Recompile ruby from scratch and use the --with-readline-dir=/usr/
local switch

or if you have downloaded the ruby sources earlier and built it by
hand,

   1. Go to the ext/readline folder of your ruby source tree
   2. Type ruby extconf.rb and then run the make  make install
procedure for ruby.

See example below

mfnit1 blog $ cd /usr/src/ruby-1.8.6/ext/readline/
mfnit1 readline $ ls
depend  extconf.rb  Makefile  mkmf.log  readline.c  readline.o
README  README.ja
mfnit1 readline $ ruby extconf.rb
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... yes
checking for rl_filename_completion_function in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_username_completion_function in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_completion_matches in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_deprep_term_function in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/
readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/
history.h... yes
checking for rl_cleanup_after_signal()... yes
checking for rl_clear_signals()... yes
checking for rl_vi_editing_mode()... yes
checking for rl_emacs_editing_mode()... yes
checking for rl_clear_signals()... yes
checking for replace_history_entry()... yes
checking for remove_history()... yes
creating Makefile
$ cd /usr/src/ruby-1.8.6
$ make
$ make install

Test of script/console
mfnit1 ruby-1.8.6 $ cd /var/www/html/blog/
mfnit1 blog $ script/console
Loading development environment (Rails 2.3.5)


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Getting an error while running activerecord test suite

2010-05-01 Thread Neeraj Singh
I downloaded the rails edge

 cd activerecord
 rake test_mysql

I am getting an exception at line 165 block.
http://github.com/rails/rails/blob/master/activerecord/test/cases/validations/uniqueness_validation_test.rb#L165

Line 169 ( 
http://github.com/rails/rails/blob/master/activerecord/test/cases/validations/uniqueness_validation_test.rb#L169)
says that if database is not UTF-8 then test will fail.

I think my database is UTF-8. Take a look at this. http://gist.github.com/386040

What am I missing? What do I need to do so that this test passes.

For the sake of completeness I would a say I have one test in error
( this one) and two other tests are failing. It seems the other two
failing tests are also because of UTF-8 issue.

Thanks

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rails3 console : how to get actual sql statements

2010-05-01 Thread Nadal
In rails 2.3.5 world I get to see all the sql statements on my
console. Thanks to following line of code in my ~/.irbc

if ENV['RAILS_ENV']
  Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
end

However above code does not do its magic in rails3 world.

In rails3 what do I need to do to see sql statements in my rails
console.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How many connection pool should we have for internet facing apps?

2010-05-01 Thread Frederick Cheung


On Apr 30, 6:52 pm, Joe Smith unknown_kev_...@hotmail.com wrote:
 Frederick Cheung wrote:
 On Apr 29, 1:57 am, Joshua Partogi
 joshua.part...-re5jqeeqqe8avxtiumw...@public.gmane.org wrote:
  Hi all,

  This is a rather basic question about connection pooling in ruby on
  rails. In rails we can define the connection pool in database.yml. I
  assume it is quite safe to hardcode this value for intranet
  application since we would know how many users that will be using the
  apps. But for an internet facing apps where we don't know how many
  users that will be accessing the app, how many connection pool should
  we provide ? Can anyone share their experience on this to enlighten
  me?

 Connection pool size isn't really related to number of users. It
 doesn't really make much difference without a multithreaded setup (and
 your default 'normal' ruby + passenger or mongrel isn't one of those)

 Fair enough, in the default state with passenger, you have a multi-process
 setup, and since each process is independent, they don't know of each other,
 and thus the value for connection in the database.yml file is more or less
 meaningless. (It is good to be explicit in explainging why this is the
 case).

 Nevertheless, the database itself may have a limited connection pool, rather
 than using the standard UNIX model of fork a new process on connection, or
 othewrwise put a user-configurable constraint on number of active
 connections. (I undertsand that MySQL often has such a limit.) Any guidance
 for the original poster on how best to deal with that?

Well if your database has a limit on the number of connections, ensure
that it's greater than the number of mongrels/passenger instances
(and if you're going to actually be using the connection pooling stuff
i suppose you'd want to make it greater than the sum of the size of
the connection pool across application instances). I seem to remember
the default limit on mysql is 100, but it can go way higher than that
(and if you are going to have several hundred mongrels you can
probably afford a big beefy database server too)

Fred

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Getting an error while running activerecord test suite

2010-05-01 Thread Nadal
This issue is resolved. For the record I resolved this issue by
creating database through rake task.

rake mysql:drop_databases
rake mysql:build_databases

On May 1, 12:09 am, Neeraj  Singh neeraj@gmail.com wrote:
 I downloaded the rails edge

  cd activerecord
  rake test_mysql

 I am getting an exception at line 165 
 block.http://github.com/rails/rails/blob/master/activerecord/test/cases/val...

 Line 169 
 (http://github.com/rails/rails/blob/master/activerecord/test/cases/val...)
 says that if database is not UTF-8 then test will fail.

 I think my database is UTF-8. Take a look at 
 this.http://gist.github.com/386040

 What am I missing? What do I need to do so that this test passes.

 For the sake of completeness I would a say I have one test in error
 ( this one) and two other tests are failing. It seems the other two
 failing tests are also because of UTF-8 issue.

 Thanks

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Nested Forms with belongs_to association

2010-05-01 Thread Sereno Mendes
Mlle wrote:
 You should probably have the Person have an Address, that way you can
 nest the Address creation form within your Person form.
 Logically, you shouldn't nest the form of an Address within a Person
 form since it's the Address that owns the Person according to your
 current model...

No, no. I solved the issue and the creation makes sense. View this post 
and you will understand why.

http://stackoverflow.com/questions/1313149/getting-fields-for-and-accepts-nested-attributes-for-to-work-with-a-belongs-to-re
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: fields_for: how many objects can it handle - max string size?

2010-05-01 Thread Frederick Cheung


On Apr 30, 7:16 pm, Kurt k...@cissor.com wrote:
 Our app is getting a string sizes too big error in an .erb file that
 is trying to render a large block of checkboxes that represent color
 attributes that belong_to the product being edited in this view.  The
 code worked fine when we had a small number of colors -- now that the
 number of colors is 750+, we get an error on the fields_for line (see
 below).


There's only one place in the ruby C code I could find that raises
'string sizes too big'. It's raised in a string concatenation function
if the length of the existing string plus the length of what you're
concatenating exceeds LONG_MAX, ie 2^31-1 on a 32bit system. I'm not
sure why fields for would be attempting to concatenate two strings
with a combined length of 2GB.

Fred

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Updating an Application

2010-05-01 Thread Frederick Cheung


On May 1, 2:13 am, doug ddjol...@gmail.com wrote:
 I have deployed several instances of a Rails application.  I am now
 considering how I might apply application updates to each of the
 various instances.  I would like the updates to be contained in some
 sort of an archive like a tar archive.  There are two types of files
 to be included in the archive:

 1)  Files which should only be written if there is no corresponding
 file in the installation. These would typically be new files that are
 being added from the archive.
 2)  Files which should overwrite corresponding installed files only if
 the archive file is newer than the installed file.

 The problem is that the tar archive does not allow me to specify the
 overwriting rule to be applied on a file by file basis.  Thus unless
 there is some way to do this that I don't know about, I would really
 need 2 tar archives for each update.  I see this as being unacceptably
 cumbersome.  I reason that there must be a better way.  Does anyone
 know what that better way is (possibly a different archiving tool)?
 Thanks for any input.


Why do you need this system rather than just pulling down the latest
version from source control ?

Fred

            ... doug

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Updating an Application

2010-05-01 Thread Hassan Schroeder
On Fri, Apr 30, 2010 at 6:13 PM, doug ddjol...@gmail.com wrote:

 1)  Files which should only be written if there is no corresponding
 file in the installation. These would typically be new files that are
 being added from the archive.
 2)  Files which should overwrite corresponding installed files only if
 the archive file is newer than the installed file.

3) What about files that need to be removed? :-)

As Fred said, you're almost certainly better off to just deploy from
your source repository (using e.g. Capistrano).

But if you *must* do something like the above, it's called `rsync` and
it handles case #3 as well.

HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: rails3 console : how to get actual sql statements

2010-05-01 Thread funkensturm
All I know is that RAILS_ENV is now Rails.env and RAILS_DEFAULT_LOGGER
is now Rails.logger

Maybe this helps you to find the solution :)

Other than that I usually open a second Terminal window and do a

tail -f log/development.log

there I see the SQL statements which I evoked from the console.
Usually even color coded.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Users Uploading Files To An asset_host

2010-05-01 Thread MaggotChild
I'm curious how people put static files uploaded by users to their
asset host.

I'd think (for non S3, CloudFiles, etc...)  that the files would be
submitted to the app server which would save them to a shared drive on
the asset host. I've head bad things about NFS and high volume sites.
Is Samba is an acceptable alternative?

Putting part of the app on the asset host and submitting directly to
it makes some sense, though it somewhat defeats the separation of app
server, asset host, etc...

How are you guys handling this?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] cannot grok form_for

2010-05-01 Thread Fearless Fool
I'm stumped with form_for().  I've RTFM'd until my eyeballs have bled.
I've looked over examples.  I still don't get it, and each thing I try
leads to some other error.  If someone can lead me to form_for
enlightenment, I'd be in your debt.

I'm using RESTful, shallow routing: one User :has_many Reports.
A Report has three fields of importance:
 -- user_id (its parent)
 -- location_id (reference to a Location record)
 -- report_type (graph or chart)

I'm trying to write a _report.html.erb partial that does double duty: it
can fill in fields of a new report (report.new_record? = true) as well
as update fields of an existing report (report.new_record? = false).

The _report partial receives two inputs: report is the current report
(either new or extant), and @user is set to the owning user.

The form_for needs present the user with [location_id] and [report_type]
fields (eventually to be replaced by pull_down lists), and needs to
silently fill in the [user_id] field of the report.  Then, upon
form.submit(), it needs to 'POST user_reports_path(@user.id)' for new a
report, or 'PUT report_path(report.id)' for updating a report.

But even my basic attempts get an error message, and I'm not sure why:
==
% form_for(:report, report, :url = {:action = update}) do |f| %
...
==
gets an error
==
ActionView::TemplateError (No route matches {:action=update}) on line
#12 of app/views/reports/_report.html.erb
==
My reports_controller.rb *does* have an update method.  Perhaps because
it's not using the HTTP PUT method?  If so, how do you specify which
HTTP method gets invoked when you click on the form.submit button?

I feel like a wimp for even asking, but can someone give me a sketch of
what the form_for might look like here?

Many thanks.

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: cannot grok form_for with shallow nested routing

2010-05-01 Thread Fearless Fool
Okay, some elucidation:

The following works when report.new_record? is true, fails when 
report.new_record? is false:


form_for([...@user, report])
  ...

because it's trying to call the undefined function 'user_report_path'. 
(Of course it's undefined -- I've specified shallow routing!)  So 
perhaps @Alex's comment of http://www.ruby-forum.com/topic/206593 is 
relevant here.

So if I modify my form_for for the new_record vs non-new_record, it 
looks like this (yech):

% form_for((report.new_record?)?([...@user, report]):(report)) do |f| %
  %= f.submit 'JumpUpAndDown' %
% end %

Aside from looking pretty nasty, the generated HTML is a bit suspicious: 
Shouldn't it be a POST method when report.new_record? is true and a PUT 
method when report.new_record? is false?

Generated for report.new_record? == true:

form action=/users/29/reports class=new_report id=new_report 
method=post
input id=report_submit name=commit type=submit 
value=JumpUpAndDown /
/form

Generated for report.new_record? == false:

form action=/reports/79 class=edit_report id=edit_report_79 
method=post
input id=report_submit name=commit type=submit 
value=JumpUpAndDown /
/form

What am I missing here?

- ff
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rails ROUTING map.root

2010-05-01 Thread David Zhu
Is it possible to put an if/else statemnt, and change the map.root
under each condition? for ex--

if current_user
map.root :controller = 'current_user'

else

map.root :controller = 'home'

end



cuase apparenlty that doesn't work, so is there an alternative way?
basically if the user is logged in, i dont want the homepage to be the
homepage anymore, but instead the user page.


NOTE i can't do a redirect_to in my home controller, because i
have multiple cases (current_user, current_admin, etc) and i can't
have multiple redirects in an action.

so is there a way to change the homepage according to who's logged in?
Thanks


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can't seem to install RMAGICK on Ubuntu Karmic Koala

2010-05-01 Thread Prashanth Acharya
try installing the imagemagick ruby package
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Can't seem to install RMAGICK on Ubuntu Karmic Koala

2010-05-01 Thread Gordon Yeong
1. I have installed ImageMagick and it has worked without problems for the
past many months
2. What exactly do you mean  imagemagick ruby package ? Is that Rmagick?
If that is, well, that's the reason why this thread is existing -
I cannot seem to install it successfully.


On 2 May 2010 12:39, Prashanth Acharya li...@ruby-forum.com wrote:

 try installing the imagemagick ruby package
 --
 Posted via http://www.ruby-forum.com/.

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] DB structure of a translation Web service

2010-05-01 Thread oren
I am building a Web service that will provide content for different
client via Rest API.

currently I have:  content has_many :keys (since many keys can
reference the same content)
content table has only one field - text
keys table has name and content_id

example for key: help_about
example for content: This website is for blablabla..

I want to add support for translations.
is it reasonable to store the content in separate table for each
language?
for example - content_english, content_spanish, etc.
If it is, how will rails handle it? currently Content.find 1 will
return the text of contents table.
and I will need to tell rails to grab it from content_english or
content_spanish.

btw, I looked at a gettext example and it uses only one table with
locale field to determine what language to show.  but I am not sure
it's a good solution for massive chunk of content and many languages.


Thanks!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] DB structure of a translation Web service

2010-05-01 Thread Walter McGinnis
HI oren,

There was recent similar discussion about design for content
translations and the answer I gave there may be useful to you:

http://osdir.com/ml/RubyonRailsTalk/2010-04/msg02235.html

I'm currently adding content translation to the Kete open source Rails
app (http://github.com/kete/kete and http://kete.net.nz).  You may
find some example code there useful.

A lot of people, including myself with
http://github.com/kete/mongo_translatable, are starting to use a NoSQL
backend for translation.  The latest I18n gem just added Tokyo Cabinet
support, too.

Hope this helps,
Walter


On Sun, May 2, 2010 at 4:40 PM, oren orengo...@gmail.com wrote:
 I am building a Web service that will provide content for different
 client via Rest API.

 currently I have:  content has_many :keys (since many keys can
 reference the same content)
 content table has only one field - text
 keys table has name and content_id

 example for key: help_about
 example for content: This website is for blablabla..

 I want to add support for translations.
 is it reasonable to store the content in separate table for each
 language?
 for example - content_english, content_spanish, etc.
 If it is, how will rails handle it? currently Content.find 1 will
 return the text of contents table.
 and I will need to tell rails to grab it from content_english or
 content_spanish.

 btw, I looked at a gettext example and it uses only one table with
 locale field to determine what language to show.  but I am not sure
 it's a good solution for massive chunk of content and many languages.


 Thanks!

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.