Ruby on Rails Friday, April 30, 2010

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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.

... 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

thanks for the reply. i screwed up. in development mode, i was
accessing my localhost, which was storing the cookie under localhost.
when i accessed my app from the domain that i registered with
facebook, i got access using the regular cookies array. hope this
helps someone...

thanks again,
dino

On Apr 30, 6:44 pm, Philip Hallstrom <phi...@pjkh.com> wrote:
> > hi -
>
> > i'm trying to integrate facebook authentication into my app.  facebook
> > sets a cookie called fbs_xxxx where xxxx is your app id.
>
> > but, i can't figure out how to get my hands on that that cookie inside
> > rails, cookies[] only gives me access to my apps cookies.
>
> If the cookie isn't in your domain, then no.
>
> Take a look at the facebooker or minifb plugins.
>
> --
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

> hi -
>
> i'm trying to integrate facebook authentication into my app. facebook
> sets a cookie called fbs_xxxx where xxxx is your app id.
>
> but, i can't figure out how to get my hands on that that cookie inside
> rails, cookies[] only gives me access to my apps cookies.

If the cookie isn't in your domain, then no.

Take a look at the facebooker or minifb plugins.


--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hey all,

The following has two columns. Each column has a head with a name and
then a data cell with a time directly below it. I'm wondering how I can
get the time to display next to the name, not below it.

- @clock.in_groups_of(2) do |group|
%tr.header
- group.each do |item|
%th= item.name
%tr
- group.each do |item|
%td
%span.value{"offset" => item.zone.now.utc_offset}
= item.zone.now.to_s(:us_short_time)

Thanks for any response.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Over a year ago I posted a question about why my £sign was printing in
one of my page and not in another although the code was the same. I
went through checking database type, collation etc and changing from
Unicode to LatinX etc. in the layout all to no avail. I temporarily
solved the problem by using &pound; or &#163; in brackets. I found the
answer a few days ago. It was the word processor used. I probably used
Ultraedit for one or notepad or Textmate or even Word for the other.
The coding in the wordprocessor was to blame. I found out when I
copied the RoR code from one page that was not working to the one that
was and after changing the controller code as well; "voila" it worked.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi -

i'm trying to integrate facebook authentication into my app. facebook
sets a cookie called fbs_xxxx where xxxx is your app id.

but, i can't figure out how to get my hands on that that cookie inside
rails, cookies[] only gives me access to my apps cookies.

thanks for any help,
dino

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Face it: to the newcomer, Rails routing is strange and mysterious. It
took me a while get the hang of it, so I thought I'd share some info
(and a couple of handy techniques) for those who are new to Rails.

Here, assume we have Users and Reports, and that one User "has many"
Reports. Normally, that will be expressed in your model files (but
that's another topic!) -- but right now we're focused on making an entry
in config/routes.rb to express how incoming URLs map to your
controllers.

In this example, we're using RESTful routing to create "shallow nested
routes" to express that a User :has_many Reports. So we create an entry
in config/routes.rb like this:

====== config/routes.rb:
map.resources :users, :has_many => :reports, :shallow => true
======

Assuming we already have a controller for User, we still need a
controller for Reports. Go ahead and type "rake routes" in a shell
window to see what the routing system generated. Here are the relevant
lines for the Reports controller:

======
% rake routes
...
user_reports GET /users/:user_id/reports
{:controller=>"reports", :action=>"index"}
POST /users/:user_id/reports
{:controller=>"reports", :action=>"create"}
new_user_report GET /users/:user_id/reports/new
{:controller=>"reports", :action=>"new"}
edit_report GET /reports/:id/edit
{:controller=>"reports", :action=>"edit"}
report GET /reports/:id
{:controller=>"reports", :action=>"show"}
PUT /reports/:id
{:controller=>"reports", :action=>"update"}
DELETE /reports/:id
{:controller=>"reports", :action=>"destroy"}
...
======

Though it may not be immediately obvious, each line tells us two things:
which URL will be matched to method in the Reports controller, and a
'helper function' you can use to generate that URL.

The leftmost column is the name of the helper functions that have been
created for you, but stripped of _url or _path, so 'user_reports'
signifies 'user_reports_url(user_id)' (the fully qualified url) or
'user_repors_path(user_id)' (the abbreviated path).

The next column is the HTTP method (GET, POST, PUT, DELETE).

The third column is the path template that the routing system matches
against: the incoming URL must have this form to be a match.

And the last column is the controller and method within the controller
that gets called for that method/template combination.

Handy technique 1:
==================

To better understand those generated helper functions, launch a console.
Within the console, you can test the helper functions using
'app.<helper_fn>' like this:

======
bash-3.2$ script/console
Loading development environment (Rails 2.3.5)
>> app.user_reports_path(10)
=> "/users/10/reports"
>> app.user_reports_url(10)
=> "http://www.example.com/users/10/reports"
>> app.new_user_report_path(10)
=> "/users/10/reports/new"
>> app.edit_report_url(33)
=> "http://www.example.com/reports/33/edit"
>> app.report_path(33)
=> "/reports/33"
======

Handy technique 2:
==================

Since I haven't been writing Rails code very long I can't keep all these
routes, parameters and helper functions straight in my mind. So the
first thing I do is stub out a skeleton ReportsController and annotate
with comments lifted from 'rake routes'.

Here's what my skeleton ReportsController might look like -- the comment
before each method documents the helper function that will generate the
HTTP call to get you to that method, and what to look for in your
params[] hash.

If you look at the comments, the relationship to the output of rake
routes should be obvious. (It would be great if 'script/generate
controller' added these comments for your automatically! That will be a
future project unless someone beats me to it...)

====== file: app/controllers/reports_controller.rb
class ReportsController < ApplicationController

# arrive here via 'GET user_reports_{url|path}(user_id)'
# url has the form '/users/:user_id/reports'
def index
end

# arrive here via 'POST user_reports_{url|path}(user_id)'
# url has the form '/users/:user_id/reports'
def create
end

# arrive here via 'GET new_user_report_{url|path}(user_id)'
# url has the form '/users/:user_id/reports/new'
def new
end

# arrive here via 'GET edit_report_{url|path}(id)'
# url has the form '/reports/:id/edit'
def edit
end

# arrive here via 'GET report_{url|path}(id)'
# url has the form '/reports/:id'
def show
end

# arrive here via 'PUT report_{url|path}(id)'
# url has the form '/reports/:id'
def update
end

# arrive here via 'DELETE report_{url|path}(id)'
# url has the form '/reports/:id'
def destroy
end
end
======
So now, you can fill out your code knowing what you'll find in the
params hash when a method is called, and which helper function will
generate an HTTP call to each method within your controller.

Hope this helps.

- 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

after the full setup on hostmonster. i got this message when i go to
the default route.


any idea

Not Found

The requested URL /home/index was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2
mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 Server at www.kavinali.com
Port 80

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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

Since this sounds somewhat like some older memory leak issues, I
confirmed that our host, Engine Yard, does not have an old Ruby
version (they are on 1.8.6 patch level 287). The same error occurs on
Mac OS/X with Ruby 1.8.6 patch 369.

I've had no luck searching for that error with "fields_for" or finding
any docs on size limitations inherent to fields_for.


Processing Admin::ProductsController#edit (for 173.45.210.193 at
2010-04-29 05:21:30) [GET]
Parameters: {"id"=>"17"}
Rendering template within admin/layouts/base
Rendering admin/products/edit

ActionView::TemplateError (string sizes too big) on line #67 of app/
views/admin/products/edit.html.erb:
64:
65: <div id="colorCheckboxes"> <!-- event handler searches within
this div to find checkboxes -->
66: <% previousObject = nil -%>
67: <% f.fields_for :prod_method_colors do |pmc| -%>
68: <% pmcObj = pmc.object %>
69: <%= "<br/><br/> Colors for
#{PRINT_METHOD_TEXT[pmcObj.print_method]} <br/>" if previousObject ==
nil || (pmcObj.print_method != previousObject.print_method) %>
70: <% previousObject = pmcObj -%>

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi
> why would I be getting this error after submitting my form?
>
> NoMethodError in EchantillonsController#create
> undefined method `call' for nil:NilClass
>
Can't say from this what caused error. Please paste in which line error
happened and what is there on that line.

Just a guess only
> if params[:echantillon][:vignette].blank?

instead of this please try

unless params[:echantillon][:vignette]


Sijo
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi
Try this
http://github.com/mbleigh/seed-fu

It can read from csv. That may help you

Sijo
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi Jonathan

Read this also.
http://maintainable.com/articles/rails_asset_cache

If any modification happens to js or css as specified, then before next
release you can apply this trick


Sijo
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Frederick Cheung wrote:
>On Apr 29, 1:57 am, Joshua Partogi
><joshua.part...->Re5JQEeQqe8AvxtiuMwx3w@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?


--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

History... before it went to heck...

I have been working a project in Netbeans for a month. I did a gem
update outside of Netbeans while I was installing ImageMagick and
RMagick... I also had to remove one verson of ImageMagick to use the
one compatible with RMagick.

Everything was working well... then I went to migrate my DB back to
start fresh again and I got :

Malformed version number string mswin32 (ArgumentError)

(LARGER TRACE)

:/Ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:182:in
`initialize': Malformed version number string mswin32 (ArgumentError)
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:105:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:105:in `version_for_dir'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:47:in `refresh!'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:45:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:45:in `refresh!'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:29:in `initialize'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
gem_dependency.rb:21:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
gem_dependency.rb:21:in `add_frozen_gem_path'


Now I can't do anything... can't run project... can do anything...

Any thoughts? Did updating Ruby gems outside Netbeans screw
everything up? I am happy to start fresh but can't do a darn thing.

I am at the point where I am going to restart the whole project and
copy each file back individually!!! ahhh!!


All other old rails projects work just fine.

Thanks!

Shawn

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi
You have to type following from command prompt
rails --version
Probably that version not equal with the veriosn showing in
config/environment.rb as RAILS_GEM_VERSION.

So you have to install 2.3.5 rails by
gem install rails -v=2.3.5 OR simply gem install rails
from command prompt

Sijo
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Demec wrote:
> So far the tutorials I've seen are for encrypting text and then
> decrypting it back.
> So for example you have a
> plaintext = "some text"
>
> you encrypt it and then you decrypt it depending on how you encrypted
> it.
>
> What I am looking for is to encrypt a whole file and then store it.
> for example I allow my users to upload .doc/.xls files. I want to
> encrypt those files so I would not store them like that, and in case a
> user wants to download it back the app will decrypt it and then send
> it to user.
>
> How can I do this ?

There is no distinction between character based data or binary data in
the world of encryption. All that's important is that you take a string
of bits, mix it with some pseudo-randomly generated bits, based on a
known algorithm, and store a string of bits.

In cryptography terms the string "some text" in your example would be
called the cleartext. Not to be confused with plaintext. Cleartext can
just as easily be binary data instead of a string. The algorithm doesn't
care at all what makes up those cleartext bits.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Thu, Apr 29, 2010 at 1:01 PM, alternative451
<alternative451@gmail.com> wrote:
> hello there,
> i develop a litle rails api and i want list most favorite bookmarks
> from delicious.
> i'm looking for a request using yahoo id (i have yahoo api key and
> others stuff needed)
>
> Someone already use delicious api ?
> someone can help me ?
>

I've never done it myself but

http://delicious.com/help/thirdpartytools

has a couple of Ruby bindings for the delicious API

HTH


--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Xavier Snark wrote:

> I am learning Rails and have run into a bit of difficulty with something
> I suspect is not uncommon, but I'm having difficulty getting my point
> across to Google.
> [snip]
> when I am creating a new event record
> [snip]

I think you've minced some concepts here.

http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
states that you can access the nested model through an instance that has
a polymorphic association with another model, eg. "From an instance of
the Employee model, you can retrieve a collection of pictures:
@employee.pictures."

Polymorphic associations give you the abilities that you're after, but
not entirely. I believe that when you are creating and updating, you
need to rely on NestedAttributes of the ActiveRecord model in order to
use a single form for updating both the "subject" record and the related
record.

http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html

I haven't successfully used this, but the documentation suggests that
you must update your "subject" model with the
'accepts_nested_attributes_for :secondary' where :secondary is the
nested model in order to manipulate the related record through the
subject record's controller. This gives you the ability to modify the
related record through values supplied in the request params hash.

X
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello the following I am getting for the server How do i append it to my view in a html format.
response = { "data": "&lt;div class="datatable-column-header col1"&gt;Name&lt;/div&gt;" }
currently I am doing the following

something.prepend(
response.data);

and the output on view I am getting string from <div class="
datatable-column-header col1">Name</div>.

Thanks for any help
abhis

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Rolf Pedersen wrote:
> I'm not sure if this answers your question in regards to your specific
> example, but let's say you have a simple table with just two numerical
> columns, say two integers.
>
> SELECT i1, i2, i1+i2 AS "Sum" FROM MyTable
> will show three columns, two of them real columns from the table and one
> computed.
>
> So the term in this case is a COMPUTED column.

The term "derived column" is technically (slightly) more accurate.

ms wrote:
> Simple example: saving a user message in a corresponding table vs.
> counting all messages of a user.

1. Saving user messages in a corresponding table.

This would be called a "one-to-many relationship," or "association" for
short.

Example:
user = User.first
user.messages

2. Counting all messages of a user.

These types of calculations are called called "aggregate functions."

Example:
user = User.first
user.messages.count

2a. Caching aggregate functions.

It's also possible to store the results of aggregate functions in a
column on the parent model. Rails has built-in support for this pattern,
which is called a "counter cache."

AFAIK Rails support the counter cache only. I've occasionally wished it
had direct support for caching "sum" and "average" (avg) aggregate
functions as well, but it can still be doe manually in a similar pattern
as counter cache.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

i have a scenario where a jquery is receiving a response in the string and which content html component like "<div id=\"test\">test</div>" ideally in a view it should display only "test" but it displaying entire string <div id="test">test</div> is there any way i am deal with the problem through js or rails?

Thanks
abhis

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I load an image with FLASH-module.
So, it comes to the server as RAW_POST_DATA
I need to save it in many sizes.

When I loaded images in attach I used "paperclip". But I think, that
in current situation "paperclip" and it's "has_attached_file" is not
suitable.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Apr 30, 12:21 am, Phoenix Rising <polarisris...@gmail.com> wrote:
> The only thing I've thought about so far is setting a virtual
> attribute of some kind, but I'd like to see if anybody has a better
> idea before I jump straight to that.

I think a non-DB ("virtual") attribute is a good idea.
Simply declare the attributes with attr_accessor.

class Order < AR::B
attr_accessor :my_attribute
end

This will add the initialization of the instance variable and create
getters and setters.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I'm not sure if this answers your question in regards to your specific example, but let's say you have a simple table with just two numerical columns, say two integers.

SELECT i1, i2, i1+i2 AS "Sum" FROM MyTable
will show three columns, two of them real columns from the table and one computed.

So the term in this case is a COMPUTED column.

Best regards,
Rolf

On Fri, Apr 30, 2010 at 2:16 AM, ms <ms@tzi.de> wrote:
Hi,

thank you for reading my post. I've got s simple question: What's the
correct technical term for data which IS NOT calculated and data which
IS calculated regarding database design.

Simple example: saving a user message in a corresponding table vs.
counting all messages of a user.

If you also know the german expressions, you're welcome to post them,
too. :)

Thanks for your help,
ms

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I dont know if it's related to the actual error message you are
getting, but I believe your send_data call should look more like this:
send_data(report.imagedata, :disposition => 'inline', :type => 'image/
png', :filename => "graph.png")
You are setting it to a GIF, and not setting the disposition to
inline.

On Apr 30, 1:27 am, Fearless Fool <li...@ruby-forum.com> wrote:
> I'm trying to display a generated .png plot via send_data(), but it
> results in a server error "invalid byte sequence in US-ASCII" error.
> I'm pretty sure this means that I need to specify the encoding
> somewhere, but I haven't been able to figure out where or how to do so.
>
> Some particulars:
>
> I'm running gnuplot through a pipe to generate a plot in .png format.
> (I've tested the code by writing its output to a file and displaying it
> -- it works.)  My Report model receives the .png image as a string:
>
>   class Report << ActiveRecord::Base
>     def imagedata
>       image = GnuPlot(@gnuplot_commands)
>     end
>   end
>
> My Controller uses send_data() to serve up a page:
>
>   class ReportsController < ApplicationController
>     def plot
>       report = Report.find(params[:id])
>       send_data(report.imagedata, :type => 'image/gif')
>     end
>   end
>
> [FWIW, without really understanding it, I also tried added an :encoding
> => 'utf8' to the send_data call -- no change.] Finally, my View presents
> the result:
>
>   <img src="<%= url_for(:controller => 'reports', :action => 'plot')
> -%>" />
>
> However, the send_data() call results in a server error:
>
> ArgumentError (invalid byte sequence in US-ASCII):
>   <internal:prelude>:8:in `synchronize'
>   .../Ruby/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
>
> So the question: Where do I specify the encoding?  And what encoding is
> appropriate for a .png binary?
>
> BTW:
> "rails --version" => Rails 2.3.5
> "ruby --version" => ruby 1.9.1p376
> "mysqul --vesion" => Ver 14.14 Distrib 5.1.36
> OS = Mac OS X 10.5.8
> --
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails


I am stucked at some major issue with the AjaxForm and render_to_string.

I am using AjaxForm for uploading images with other details since the Ajax Upload library isn't even using Ajax. So once the form is submitted i need to call a partial and return it in a json format. but the problem is that the render_to_string is not working at all. In case if i am returning simple string then it's working fine.

reference http://jquery.malsup.com/form/#file-upload

#server Ruby on rails
def some_action
  respond_to do |format|
    @html = render_to_string(:partial => "form.html.erb", :object => [@obj1, @obj2])
    json = { :success => "Added successfully", :html => @html }
    format.html { render :json => json }
  end
end

#client side
$("#upload").ajaxForm({
        dataType: "json",
        success: function(response) {
          console.log(response);
          console.log(response.html);
  });
return false;
});

Thanks for any help
Abhis

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails Thursday, April 29, 2010

Assuming you have a named_route for your logout action, you could try

function bunload() {
document.location.href="<%= logout_path %>";
}

However, I would point out that unload isn't guaranteed to be called &
is even less likely to call & wait to load a new resource so that you
can kill the session. Additionally, it's usually a mark of spam sites
(they do alert popups), so if at all possible you should avoid
onunload.

In reality, if you are using Rails defaults, the session is all stored
on the client anyway, so there is no server load to have the session
naturally expire when the browser quits (not when a user opens a
different url or closes the window). If you are storing sessions on
the server, you can easily setup a sweeper to clear out sessions not
accessed in some time (or set that as a default in your environment)

Niels


instead of logout_path m giving string "/user/logout" which is the url
for logout but its not working why.

please help..

rahul


m trying to call my user controller logout action from onunload
function

On Apr 29, 5:33 pm, Rahul Mehta <rahul23134...@gmail.com> wrote:
> hiii niels
>
> thank for reply.
>
> can u help me how to run logout action of controller user on
> window.location.href..
>
> thanks
>
> rahul
>
> On Apr 29, 5:15 pm, Niels Meersschaert <nmeersscha...@mac.com> wrote:
>
>
>
> > Ruby files aren't evaluated when they are in the Public folder, their contents are just returned to the user.  You would need to have it call a controller action to run code.
>
> > On Apr 29, 2010, at 8:01 AM, Rahul Mehta wrote:
>
> > > hii
>
> > > i have my ror app website want to do destroy session on browser
> > > close ,
>
> > > please help how can i destroy..
>
> > > i have used javascript function on body unload
>
> > >  function bunload()
> > > {
> > >   document.location.href="del.rb";
> > > }
> > > </script>
> > > </head>
> > > <body onunload="bunload()">
>
> > > and i have putted the del.rb file in my public folder  and in that i
> > > have putted the following code
>
> > >  session[:user] = nil
>
> > > but its not destroying the session..
>
> > > please help..
>
> > > thanks
>
> > > rahul
>
> > > --
> > > 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-talk@googlegroups.com.
> > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

can any one help me.
i created one application to track the people opening the mails which is
send by me from my application. but one problem which became an
obstacle in my path is when any use say tony opens that mail once
his count in db is one,but his count will not increment when he go
back to his inbox and click the mail again.for that he had to
refresh the inbox, means had to press F5 to clear the
cache.actually inorder to track the open users i am passing an image to
the controller from view page

is there any methode to avoid this?


or any method to clear the cache.please help me


Thanks;
Tony
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I found an authlogic newsgroup: http://groups.google.com/group/authlogic.
I cross-posted this question there.

On Apr 29, 4:08 pm, RichardOnRails
<RichardDummyMailbox58...@USComputerGurus.com> wrote:
> Hi,
>
> I am following the instructions on
>        http://github.com/binarylogic/authlogic_example#readme,
>             specifically, the Tutorial "How to create this app ..."
> section:
> Step 1 of the tutorial contained three sub-step which I identify here
> Step 1/a,b and c.
> The details of these steps and their consequences are shown below in
> detail.
> Following execution of Steps 1a and 1b of the Tutorial, I followed the
> advice at the top of Step 1bm i.e.
> I restarted my web-server. That led to an error notification regarding
> the instruction
>         config/environment.rb, line 10, which is:  config.gem "authlogic"
>
> An I ideas about how I can deal with this problem?  Details followL
>
> Thanks in Advance,
> Richard
>
> My environment includes:
> WinXP-Pro/SP3, Ruby 1.8.2-15, Rails 1.1.6, Gem 0.9, MySQL 5.0.27-nt,
> SciTE 1.72, AuthLogic gem, FireFox 2.0.0.4
>
> Step 1a: Install the gem / plugin -- I got:
> gem install authlogic
> Successfully installed authlogic-2.1.3
> 1 gem installed
> Installing ri documentation for authlogic-2.1.3...
> Installing RDoc documentation for authlogic-2.1.3...
> ---
> I checked whether the gem was installed by executing:
> dir K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
> and got:
> K:\>dir K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
> \authlogic*.*
>  Volume in drive K is K02-100G_NT
>  Volume Serial Number is B00C-F65F
>
>  Directory of K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
>
> 04/28/2010  10:36 AM    <DIR>          authlogic-2.1.3
>                0 File(s)              0 bytes
>                1 Dir(s)  56,204,374,016 bytes free
>
> K:\>
>
> Step 1b: Add the gem dependency in your config, so now lines 1-10 in
> config\environment.rb are:
>         # Be sure to restart your server when you modify this file
>
>         # Specifies gem version of Rails to use when vendor/rails is not
> present
>         RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
>
>         # Bootstrap the Rails environment, frameworks, and default
> configuration
>         require File.join(File.dirname(__FILE__), 'boot')
>
>         # Hook-up  AuthLogic
>         config.gem "authlogic"
>
> Step 1c: Following the caution in Setp1b,  I ran "ruby script/server"
> and got:
>         => Booting Mongrel
>         => Rails 2.3.5 application starting onhttp://0.0.0.0:3000
>         K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/config/environment.rb:10:
> undefined local variable or method `config' for main:Object
> (NameError)
>
> --
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

> Thank you all, so very much, for your great, thoughtful posts and solid
> advice. You all have excellent points. I've decided to take your advice
> as wise council, and stick with the single-table model. :)

Hi,

if you find you *DO* have to shard in your application, then I used
the approach:

todo_items_<user_id>

and created a base level todo_items (which held no values) and created
the tables todo_items_<user_id> with the MySQL statement:

create table todo_items_<user_id> like todo_items

Migration can be a bit of a pain though!

Once you know the user_id in your controller the you can just do

TodoItem.set_table_name "todo_items_#{@user.id}"

Just my 2 pennies worth

Allan

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi guys,
I looked around.
I am running ruby 1.9.1.

Found this (http://forum.clockingit.com/discussion/381/) and it said
"Ruby 1.9.1 isn't supported at all, so please try 1.8.x instead.".


That post was posted on "Mar 2nd 2009".

Has this compatibility problem been resolved?
Any ideas?

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi guys,
 I looked around.
I am running ruby 1.9.1.

Found this (http://forum.clockingit.com/discussion/381/) and it said "Ruby 1.9.1 isn't supported at all, so please try 1.8.x instead.".


That post was posted on "Mar 2nd 2009".

Has this compatibility problem been resolved?
Any ideas?

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have a legacy e-commerce app that's got about 12,000 inventory items
in it, including pairings between items in one model to items in
another. There's no way we'll have the manpower to manually add all
those items and their pairings again ("ah cannah dew ih, cap'n!"), so
I'm hoping to write a series of either Ruby or raw SQL scripts to move
the data from my legacy DB to my current development DB, then run
something that will dump all the information in my new development DB
(once properly re-formatted for use in the new data schema) straight
into seeds.rb so I can just load the schema and seed it upon
deployment.

Does anyone know of an existing tool that'll help get the job done?
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

it's ok. I will keep trucking.

 thank you :)

any ideas, guys? :)



On 30 April 2010 10:22, Simon Macneall <macneall@gmail.com> wrote:
then I am out of ideas, sorry :)


--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

then I am out of ideas, sorry :)

On Fri, 30 Apr 2010 08:17:16 +0800, ct9a <anexiole@gmail.com> wrote:

> hi, Simon,
>
> 1. when I checked mkmf.log, there were no errors but a bunch of "yes"
> 2. don't know why but i cannot find the mkmf.log file now

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi, Simon,

1. when I checked mkmf.log, there were no errors but a bunch of "yes"
2. don't know why but i cannot find the mkmf.log file now

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi,

thank you for reading my post. I've got s simple question: What's the
correct technical term for data which IS NOT calculated and data which
IS calculated regarding database design.

Simple example: saving a user message in a corresponding table vs.
counting all messages of a user.

If you also know the german expressions, you're welcome to post them,
too. :)

Thanks for your help,
ms

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I seem to remember something similar when I was installing it on Karmic
ages ago.
If you go look in the mkmf.log that it talks about (can't remember where
it is located) it indicates what the problem was. Mine was to do with
other libs that needed to be installed. Things like build-essentials.
Also, once you get the exact error message from the log file, you can
usually google that to get a more specific idea of how to resolve the
problem.

Cheers
Simon

On Fri, 30 Apr 2010 08:08:20 +0800, ct9a <anexiole@gmail.com> wrote:

> hi guys,
>
> I have been trying to install Rmagick on ubuntu karmic koala for a
> day.
>
> Yes, ImageMagicK has already been installed and works great with
> paperclip and a few other perl scripts I have (which uses
> Image::Magick).
>
> The following is what the execution looks like when I tried to
> install rmagick ( " gem install rmagick" ):
>

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi guys,

I have been trying to install Rmagick on ubuntu karmic koala for a
day.

Yes, ImageMagicK has already been installed and works great with
paperclip and a few other perl scripts I have (which uses
Image::Magick).

The following is what the execution looks like when I tried to
install rmagick ( " gem install rmagick" ):

-------------------- Extract start
----------------------------------------------


ct9a@ubuntu-karmic-koala:~/projects/RealAutoParts# gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
/usr/local/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/1.9.1/mkmf.rb:433:in `try_cpp'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:811:in `block in
have_header'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:670:in `block in
checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `block (2
levels) in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `block in
postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:810:in `have_header'
from extconf.rb:193:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/
rmagick-2.13.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/
ext/RMagick/gem_make.out

-------------------- Extract end-
----------------------------------------------

Any ideas, guys?

thank you :)

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Woops, I posted a severely outdated environment list:

> WinXP-Pro/SP3, Ruby 1.8.2-15, Rails 1.1.6, Gem 0.9, MySQL 5.0.27-nt,
> SciTE 1.72, AuthLogic gem, FireFox 2.0.0.4

The correct environment list is (I think):

WinXP-Pro/SP3, Ruby 1.8.2-15, Rails 2.3.5, Gem 0.9, MySQL 5.0.27-nt,
SciTE 1.74, AuthLogic-2.1.3
FireFox 3.6.3, IE 8.0, OE 6.0, MS Office 2003 SP3, Nero Ultra 9
Java 1.6.0_19, JVM 1.5.0_11-b03, Apache Tomcat/5.5.12, Visual Prolog
7.0,
...

BTW, I've thought there would be a user-group for authlogic, but I
haven't found one yet.

Best wishes,
Richard

On Apr 29, 4:08 pm, RichardOnRails
<RichardDummyMailbox58...@USComputerGurus.com> wrote:
> Hi,
>
> I am following the instructions on
>        http://github.com/binarylogic/authlogic_example#readme,
>             specifically, the Tutorial "How to create this app ..."
> section:
> Step 1 of the tutorial contained three sub-step which I identify here
> Step 1/a,b and c.
> The details of these steps and their consequences are shown below in
> detail.
> Following execution of Steps 1a and 1b of the Tutorial, I followed the
> advice at the top of Step 1bm i.e.
> I restarted my web-server. That led to an error notification regarding
> the instruction
>         config/environment.rb, line 10, which is:  config.gem "authlogic"
>
> An I ideas about how I can deal with this problem?  Details followL
>
> Thanks in Advance,
> Richard
>
> My environment includes:
> WinXP-Pro/SP3, Ruby 1.8.2-15, Rails 1.1.6, Gem 0.9, MySQL 5.0.27-nt,
> SciTE 1.72, AuthLogic gem, FireFox 2.0.0.4
>
> Step 1a: Install the gem / plugin -- I got:
> gem install authlogic
> Successfully installed authlogic-2.1.3
> 1 gem installed
> Installing ri documentation for authlogic-2.1.3...
> Installing RDoc documentation for authlogic-2.1.3...
> ---
> I checked whether the gem was installed by executing:
> dir K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
> and got:
> K:\>dir K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
> \authlogic*.*
>  Volume in drive K is K02-100G_NT
>  Volume Serial Number is B00C-F65F
>
>  Directory of K:\_Utilities\ruby186-26_rc2\ruby\lib\ruby\gems\1.8\gems
>
> 04/28/2010  10:36 AM    <DIR>          authlogic-2.1.3
>                0 File(s)              0 bytes
>                1 Dir(s)  56,204,374,016 bytes free
>
> K:\>
>
> Step 1b: Add the gem dependency in your config, so now lines 1-10 in
> config\environment.rb are:
>         # Be sure to restart your server when you modify this file
>
>         # Specifies gem version of Rails to use when vendor/rails is not
> present
>         RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
>
>         # Bootstrap the Rails environment, frameworks, and default
> configuration
>         require File.join(File.dirname(__FILE__), 'boot')
>
>         # Hook-up  AuthLogic
>         config.gem "authlogic"
>
> Step 1c: Following the caution in Setp1b,  I ran "ruby script/server"
> and got:
>         => Booting Mongrel
>         => Rails 2.3.5 application starting onhttp://0.0.0.0:3000
>         K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/config/environment.rb:10:
> undefined local variable or method `config' for main:Object
> (NameError)
>
> --
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I early Rails 2, I wrote code in my show.erb.html file like this:

<% display_qs_body(binding) %>

display_qs_body was in a helper file and it passed binding along and
used (as I recall) concat(binding, "text"). concat changed so you no
longer passed binding somewhere later in Rails 2.

I came to believe that this worked but was not really the proper way to
do things. So, that is really what I'm asking... how is a view suppose
to call into a helper which may call into a template which calls back to
a helper, etc.

The helpers may or may not want to prepend or append text to what the
next level deeper.

And, since Rails 3 is just around the corner, how does this sort of
thing work in Rails 3?

Thank you,
Perry
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I'm trying to display a generated .png plot via send_data(), but it
results in a server error "invalid byte sequence in US-ASCII" error.
I'm pretty sure this means that I need to specify the encoding
somewhere, but I haven't been able to figure out where or how to do so.

Some particulars:

I'm running gnuplot through a pipe to generate a plot in .png format.
(I've tested the code by writing its output to a file and displaying it
-- it works.) My Report model receives the .png image as a string:

class Report << ActiveRecord::Base
def imagedata
image = GnuPlot(@gnuplot_commands)
end
end

My Controller uses send_data() to serve up a page:

class ReportsController < ApplicationController
def plot
report = Report.find(params[:id])
send_data(report.imagedata, :type => 'image/gif')
end
end

[FWIW, without really understanding it, I also tried added an :encoding
=> 'utf8' to the send_data call -- no change.] Finally, my View presents
the result:

<img src="<%= url_for(:controller => 'reports', :action => 'plot')
-%>" />

However, the send_data() call results in a server error:

ArgumentError (invalid byte sequence in US-ASCII):
<internal:prelude>:8:in `synchronize'
.../Ruby/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'

So the question: Where do I specify the encoding? And what encoding is
appropriate for a .png binary?

BTW:
"rails --version" => Rails 2.3.5
"ruby --version" => ruby 1.9.1p376
"mysqul --vesion" => Ver 14.14 Distrib 5.1.36
OS = Mac OS X 10.5.8
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

thanks jason i'll talk to them and get back to u.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Sounds like they don't have your SSH account setup correctly

Sent from my iPhone

On Apr 29, 2010, at 6:08 PM, nirosh <kunalan.kandiah@gmail.com> wrote:

> hi i have setup my rails env on hostmonster but i cant run rake
> task.error is populated when try to run that
> the error is "Access denied for user ". But i can able to login into
> the mysql with the same user name password.
>
> anybody any ideas????
>
> 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-
> talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi i have setup my rails env on hostmonster but i cant run rake
task.error is populated when try to run that
the error is "Access denied for user ". But i can able to login into
the mysql with the same user name password.

anybody any ideas????

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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I'm trying my best to follow the skinny controller/fat model concept,
and I've got a series of callbacks (that I'm about to move into
observers) running on a few models. Based on what these callbacks do
to the data (it's implementing business rules), I'd like to add some
type of message on the state of the model *without* invalidating it.

For example:

class Order < ActiveRecord::Base
after_save :do_something_cool

private
def do_something_cool
# manipulates the order object in some way based on business rules
errors.add_to_base("Message about what we did to your order to
match said business rules")
end
end

I'd prefer to do this without calling errors.add_to_base, because it
isn't an error. Furthermore, I don't even think that works because
it's being called -after- the model is saved (so far, even though the
callback in my case is running, it doesn't appear to be adding
anything to the base errors object anyway).

Obviously I can't set flash[:notice] inside the model as it's owned by
the controller, and I really don't want to do some insane hacking to
incorporate elements of the controller into the model (that would
really make this spaghetti code and kill performance!).

The only thing I've thought about so far is setting a virtual
attribute of some kind, but I'd like to see if anybody has a better
idea before I jump straight to that.

Any thoughts on the matter? Thanks for any input you can provide!

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I used SQL Server 2005 for 18 months for a rails application. I recall
having to use both freetds and unixodbc to get the connection to work.
I'm a little hazy on this, but I think one is a higher level
communication protocol, and one is a lower level communication
protocol. Google the rest if it helps

On Wed, Apr 28, 2010 at 4:08 PM, rhossi <felipecpg@gmail.com> wrote:
> We are developing a solution for a client. Today he is using ASP.NET
> with SQL Server 2008 and wanna use SQL Server 2008 as database for the
> Rails application as well.
>
> So, they were asking us why Active Record uses unixODBC to communicate
> with SQL Server instead of using only freeTDS - they were concerned
> about performance problems.
>
> We googled the subject a little bit, and we weren't able to find any
> Ruby solution that uses solely freeTDS. They all used unixODBC in some
> sort of way.
>
> Questions:
>
> 1) Why the freeTDS solutions out there always uses unixODBC in some
> sort of way?
> 2) Is it possible to communicate with SQL Server using only freeTDS?
> 3) Will we gain any performance using only freeTDS instead of freeTDS
> + unixODBC
>
> Thanks in advance.
>
> --
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

So far the tutorials I've seen are for encrypting text and then
decrypting it back.
So for example you have a
plaintext = "some text"

you encrypt it and then you decrypt it depending on how you encrypted
it.

What I am looking for is to encrypt a whole file and then store it.
for example I allow my users to upload .doc/.xls files. I want to
encrypt those files so I would not store them like that, and in case a
user wants to download it back the app will decrypt it and then send
it to user.

How can I do 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Apr 29, 2010, at 2:01 PM, Robert Walker wrote:

> David Zhu wrote:
>> Is it possible to do a find all, and then return the # of items?
>
> Better to use the built-in aggregate functions.
>
> http://railsapi.com/doc/rails-v2.3.5/classes/ActiveRecord/Calculations/ClassMethods.html#M001357
>
> This will perform the count in SQL and will be much more efficient
> than
> building all those ActiveRecord objects.

+1, but if you already have them you can use .size() to get the count.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.