[Rails] Re: InstantRails and new gems

2009-03-23 Thread ruby...@ymail.com



On 24 Mar., 02:51, Pierre Pierre 
wrote:
> Jeff Emminger wrote:
> > perhaps you need
>
> >   require 'wxruby2'
>
> > in your code?  or maybe
>
> >   require 'rubygems'
> >   require 'wxruby2'
>
> > On Mar 23, 1:08?am, Pierre Pierre 
>
> I have the "require" in my code.
> I somehow imagine that it's the console which doesn't look it the
> correct path, but I don't really know how to fix that one :s

Try `gem install wxruby`.

--
Best regards,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Uncommenting a line in environment.rb file

2009-03-23 Thread Gouthami Rao

Hi, I am a newbee to rubyonrails. I was given task of migration of
database from mysql to oracle for a ror application.

My probelm is when I go into my environment.rb file and uncomment the;

config.action_controller.session_store = :active_record_store

my application doesnt work atall. I do have a sessions table but the
sessions table data is not being updated with the latest time and date.
Before this application was working with MySql database, it was working
properly, but now am using oracle and its not working.

And if I comment it,

#config.action_controller.session_store = :active_record_store

the application is working fine. But I need sessions for my entire
aplication.
Can you please suggest how I should proceed?
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Phlip

> Why not create your method as a module and then include it into the  
> classes you need it?  Look at any of the plugins out there that are of  
> the "acts_as_" variety which add methods to the model they are  
> called from... just follow those examples and you shouldn't need to  
> directly modify AR::Base like this.

Further, adding a method to a class is a perfectly reasonable solution, and is 
not "monkey patching". That's when you change a preexisting method, simply 
because it offered no hook for you to override.

In order from sublime to icky...

  - delegate to the behavior you need
  - include/extend the behavior
  - inherit the behavior
  - add the behavior to your base class
  - trigger the behavior with an 'if' statement
  - monkey-patch the behavior into a closed class

Yes, folks, the lowly 'if' statement is the second-worst option in Object 
Oriented programming. Use it with extreme caution!


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



[Rails] Re: Linking a model to a specific user - RESTful Authentication

2009-03-23 Thread Vince Gilbert

I thought I would include the sessions controller too, just in case it 
helps:

# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
  # Be sure to include AuthenticationSystem in Application Controller 
instead


  # render new.rhtml
  def new
  end

 # render logout.rhtml
  def logout
  end

  def create
self.current_user = User.authenticate(params[:login], 
params[:password])
if logged_in?
  if params[:remember_me] == "1"
current_user.remember_me unless current_user.remember_token?
cookies[:auth_token] = { :value => 
self.current_user.remember_token , :expires => 
self.current_user.remember_token_expires_at }
  end
  redirect_back_or_default('/')
  flash[:notice] = "Logged in successfully"
else
  render :action => 'new'
end
  end

  def destroy
self.current_user.forget_me if logged_in?
cookies.delete :auth_token
reset_session
flash[:notice] = "You have been logged out."
redirect_back_or_default('/')
  end
end


Vince Gilbert wrote:
> Hi,
> 
> I am having a really tough time figuring this out. I followed the
> tutorial below to add a RESTful authentication to a Ruby application
> that tracks projects (just a title and a url).  The tutorial is for a
> blog, but I just changed blog to projects
> 
>  http://ruby.about.com/od/rubyonrails/ss/railsblog3.htm
> 
> My main table of projects is:
> 
> projects
> ---
> ID: integer
> Title: string
> Url: string
> 
> The RESTful Authentication plugin adds:
> 
> user
> --
> ID: integer
> login: varchar
> password:varchar
> 
> 
> and a sessions controller.
> 
> I would like the application to show the user a list of the projects
> that belong to them when they go do the projects index action.  However,
> I have no idea how to link the user ID to a particular project and then
> list their projects based on whether they are the appropriatly logged in
> user.
> 
> I figure that when a new project is created, the create method could add
> the user ID to the project in another column.  And then, when the
> list/show action is called for the projects, only the appropriate
> projects will show.
> 
> Here is the projects controller.  Can anyone help me with this?  I'm in
> over my head.  Thanks, Vince.
> 
> class ProjectsController < ApplicationController
>   before_filter :login_required
> 
>   # GET /projects
>   # GET /projects.xml
>   def index
> @projects = Project.find(:all)
> respond_to do |format|
>   format.html # index.html.erb
>   format.xml  { render :xml => @projects }
> end
>   end
> 
>   # GET /projects/1
>   # GET /projects/1.xml
>   def show
> @project = Project.find(params[:id])
> 
> 
> respond_to do |format|
>   format.html # show.html.erb
>   format.xml  { render :xml => @project }
> end
>   end
> 
>   # GET /projects/new
>   # GET /projects/new.xml
>   def new
> @project = Project.new
>  respond_to do |format|
>   format.html # new.html.erb
>   format.xml  { render :xml => @project }
> 
> end
>   end
> 
>   # GET /projects/1/edit
>   def edit
> @project = Project.find(params[:id])
>   end
> 
>   # POST /projects
>   # POST /projects.xml
>   def create
> @project = Project.new(params[:project])
>#...@project.clientid = @session['user'].id
> respond_to do |format|
>   if @project.save
> 
> flash[:notice] = 'Project was successfully created.'
> format.html { redirect_to(@project) }
> format.xml  { render :xml => @project, :status => :created,
> :location => @project }
>   else
> format.html { render :action => "new" }
> format.xml  { render :xml => @project.errors, :status =>
> :unprocessable_entity }
>   end
> end
>   end
> 
>   # PUT /projects/1
>   # PUT /projects/1.xml
>   def update
> @project = Project.find(params[:id])
> 
> respond_to do |format|
>   if @project.update_attributes(params[:project])
> flash[:notice] = 'Project was successfully updated.'
> format.html { redirect_to(@project) }
> format.xml  { head :ok }
>   else
> format.html { render :action => "edit" }
> format.xml  { render :xml => @project.errors, :status =>
> :unprocessable_entity }
>   end
> end
>   end
> 
>   # DELETE /projects/1
>   # DELETE /projects/1.xml
>   def destroy
> @project = Project.find(params[:id])
> @project.destroy
> 
> respond_to do |format|
>   format.html { redirect_to(projects_url) }
>   format.xml  { head :ok }
> end
>   end
> end

-- 
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+unsubscr...@googlegroups.com
For more options

[Rails] Linking a model to a specific user - RESTful Authentication

2009-03-23 Thread Vince Gilbert

Hi,

I am having a really tough time figuring this out. I followed the
tutorial below to add a RESTful authentication to a Ruby application
that tracks projects (just a title and a url).  The tutorial is for a
blog, but I just changed blog to projects

 http://ruby.about.com/od/rubyonrails/ss/railsblog3.htm

My main table of projects is:

projects
---
ID: integer
Title: string
Url: string

The RESTful Authentication plugin adds:

user
--
ID: integer
login: varchar
password:varchar


and a sessions controller.

I would like the application to show the user a list of the projects
that belong to them when they go do the projects index action.  However,
I have no idea how to link the user ID to a particular project and then
list their projects based on whether they are the appropriatly logged in
user.

I figure that when a new project is created, the create method could add
the user ID to the project in another column.  And then, when the
list/show action is called for the projects, only the appropriate
projects will show.

Here is the projects controller.  Can anyone help me with this?  I'm in
over my head.  Thanks, Vince.

class ProjectsController < ApplicationController
  before_filter :login_required

  # GET /projects
  # GET /projects.xml
  def index
@projects = Project.find(:all)
respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml => @projects }
end
  end

  # GET /projects/1
  # GET /projects/1.xml
  def show
@project = Project.find(params[:id])


respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @project }
end
  end

  # GET /projects/new
  # GET /projects/new.xml
  def new
@project = Project.new
 respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @project }

end
  end

  # GET /projects/1/edit
  def edit
@project = Project.find(params[:id])
  end

  # POST /projects
  # POST /projects.xml
  def create
@project = Project.new(params[:project])
   #...@project.clientid = @session['user'].id
respond_to do |format|
  if @project.save

flash[:notice] = 'Project was successfully created.'
format.html { redirect_to(@project) }
format.xml  { render :xml => @project, :status => :created,
:location => @project }
  else
format.html { render :action => "new" }
format.xml  { render :xml => @project.errors, :status =>
:unprocessable_entity }
  end
end
  end

  # PUT /projects/1
  # PUT /projects/1.xml
  def update
@project = Project.find(params[:id])

respond_to do |format|
  if @project.update_attributes(params[:project])
flash[:notice] = 'Project was successfully updated.'
format.html { redirect_to(@project) }
format.xml  { head :ok }
  else
format.html { render :action => "edit" }
format.xml  { render :xml => @project.errors, :status =>
:unprocessable_entity }
  end
end
  end

  # DELETE /projects/1
  # DELETE /projects/1.xml
  def destroy
@project = Project.find(params[:id])
@project.destroy

respond_to do |format|
  format.html { redirect_to(projects_url) }
  format.xml  { head :ok }
end
  end
end
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Bharat Ruparel

Thanks Phillip.  I will follow your advice and see if I can do it.
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: InstantRails and new gems

2009-03-23 Thread Pierre Pierre

Jeff Emminger wrote:
> perhaps you need
> 
>   require 'wxruby2'
> 
> in your code?  or maybe
> 
>   require 'rubygems'
>   require 'wxruby2'
> 
> 
> On Mar 23, 1:08?am, Pierre Pierre 


I have the "require" in my code.
I somehow imagine that it's the console which doesn't look it the 
correct path, but I don't really know how to fix that one :s
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] has many through not working in ruby-enterprise

2009-03-23 Thread mirec

hi,
I have simple has many through association which is working without
problem on ruby 1.8.6 and rails 2.0.2, but on ruby-enterprise with
ruby 2.0.2 or 2.3.2 it just does not see "through" part of
association.

class User < ActiveRecord::Base
  has_many :userships
  has_many :user_groups, :through => :userships
end
class UserGroup < ActiveRecord::Base
  has_many :userships
  has_many :users, :through => :userships
end
class Usership < ActiveRecord::Base
  belongs_to :user
  belongs_to :user_group
end


as i am moving app to new server, i am getting these errors:

ActiveRecord::StatementInvalid: Mysql::Error: Unknown column
'user_groups.user_id' in 'where clause': SELECT * FROM `user_groups`
WHERE (`user_groups`.user_id = 8)
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/connection_adapters/
abstract_adapter.rb:212:in `log'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/connection_adapters/
mysql_adapter.rb:320:in `execute'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/connection_adapters/
mysql_adapter.rb:595:in `select'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/connection_adapters/abstract/
database_statements.rb:7:in `select_all_without_query_cache'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/connection_adapters/abstract/
query_cache.rb:62:in `select_all'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/base.rb:661:in `find_by_sql'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/base.rb:1553:in `find_every'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/base.rb:615:in `find'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/associations/
association_collection.rb:60:in `find'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/associations/
association_collection.rb:395:in `find_target'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/associations/
association_collection.rb:349:in `load_target'
from /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/
activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:
139:in `inspect'

obviously, association is not correctly understood by ruby and
"through" part of it is not taken

anybody having similar problem? 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Ruby-GetText-Package-2.0.0

2009-03-23 Thread Masao Mutoh

No, Rails-2.2.0 - Rails-2.3.1 are not supported.

2009/3/24 Leon :
>
> does this version support rails 2.2.x?
>
> On Mar 22, 9:24 pm, Masao Mutoh  wrote:
>> Hi,
>>
>> Ruby-GetText-Package-2.0.0 is now available.
>>
>> Ruby-GetText-Package now separate 2 base libraries
>> and 3 libraries which support Ruby on Rails 2.3.2.
>>
>> For all libraries/applications:
>> * locale - Management Locale IDs
>> * gettext - Message localizations
>>
>> For Ruby on Rails:
>> * locale_rails - Rails support with locale
>> * gettext_activerecord - ActiveRecord Localization
>> * gettext_rails - Support other localization same with gettext-1.93.0.
>>
>> See HOWTO below to migrate rails-2.1.x apps to rails-2.3.2.
>>
>> * HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)
>>  http://www.yotabanana.com/hiki/ruby-gettext-rails-migration.html
>>
>> Changes
>> ---
>> * locale-2.0.0
>>    * Support Rack.
>> * locale_rails-2.0.0
>>     * I18n.translate fallbacks to the localized message in the locale 
>> candidates.
>>     * Support localized view both of gettext-1.93.0 style and rails-2.3.x 
>> style.
>>     * Support Rails-2.3.2.
>> * gettext-2.0.0
>>     * Separate this library to locale,  locale_rails, gettext_activerecord,
>>        gettext_rails.
>>     * A lot of referctoring, improvements.
>>     * Thread safe.
>>     * New APIs for gettext/tools instead of gettext/utils.
>> * gettext_activerecord-2.0.0
>>     * Support activerecord-2.3.2.
>> * gettext_rails-2.0.0
>>     * Support Rails-2.3.2.
>>     * Work with other I18n backends.
>>
>> (NOTE)
>>   * Rails-2.3.1 and earlier aren't supported.
>>
>> Thanks to
>> ---
>> Special Thanks to:
>>   Michael Grosser: A lot of improvement.
>>
>> Thanks to:
>>   Tietew, Kazuhiro NISHIYAMA,  Fabio M.A.
>>   Tuptus, Morus Walter, Vladimir Dobriakov, Ramsey.
>>
>> Website
>> ---
>> * homepage
>>    http://www.yotabanana.com/hiki/ruby-locale.html
>>    http://www.yotabanana.com/hiki/ruby-gettext.html
>> * rubyforge
>>    http://rubyforge.org/projects/locale
>>    http://rubyforge.org/projects/gettext
>> * github
>>  http://github.com/mutoh/locale/tree/master
>>  http://github.com/mutoh/locale_rails/tree/master
>>  http://github.com/mutoh/gettext/tree/master
>>  http://github.com/mutoh/gettext_activerecord/tree/master
>>  http://github.com/mutoh/gettext_rails/tree/master
>>
>> * Download
>>  http://rubyforge.org/frs/?group_id=855&release_id=2856
>>  http://rubyforge.org/frs/?group_id=1997&release_id=32471
>>
>> * Ruby-GetText-Package HOWTOs
>>  http://www.yotabanana.com/hiki/ruby-gettext-howto.html
>> * Ruby-GetText-Package HOWTO for Ruby on Rails
>>  http://www.yotabanana.com/hiki/ruby-gettext-rails.html
>> * HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)
>>  http://www.yotabanana.com/hiki/ruby-gettext-rails-migration.html
>> * Ruby-GetText-Package documents for Translators
>>  http://www.yotabanana.com/hiki/ruby-gettext-translate.html
>>
>> What's this?
>> -
>> Ruby-GetText-Package is a Localization(L10n) library and tool
>> which is modeled after the GNU gettext package.
>>
>> This library translates original messages to localized
>> messages using client-side locale information(environment
>> variable, using system locale API or CGI variable).
>>
>> The tools for developers support creating, useing, and modifying
>> localized message files(message catalogs).
>>
>> ScreenShots
>> ---
>> Screenshots in 23 languages (Sample Rails blog) 
>> are:http://www.yotabanana.com/hiki/?ruby-gettext-screenshot
>>
>> --
>> Masao Mutoh 
> >
>

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



[Rails] Re: Ruby-GetText-Package-2.0.0

2009-03-23 Thread Leon

does this version support rails 2.2.x?

On Mar 22, 9:24 pm, Masao Mutoh  wrote:
> Hi,
>
> Ruby-GetText-Package-2.0.0 is now available.
>
> Ruby-GetText-Package now separate 2 base libraries
> and 3 libraries which support Ruby on Rails 2.3.2.
>
> For all libraries/applications:
> * locale - Management Locale IDs
> * gettext - Message localizations
>
> For Ruby on Rails:
> * locale_rails - Rails support with locale
> * gettext_activerecord - ActiveRecord Localization
> * gettext_rails - Support other localization same with gettext-1.93.0.
>
> See HOWTO below to migrate rails-2.1.x apps to rails-2.3.2.
>
> * HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)
>  http://www.yotabanana.com/hiki/ruby-gettext-rails-migration.html
>
> Changes
> ---
> * locale-2.0.0
>    * Support Rack.
> * locale_rails-2.0.0
>     * I18n.translate fallbacks to the localized message in the locale 
> candidates.
>     * Support localized view both of gettext-1.93.0 style and rails-2.3.x 
> style.
>     * Support Rails-2.3.2.
> * gettext-2.0.0
>     * Separate this library to locale,  locale_rails, gettext_activerecord,
>        gettext_rails.
>     * A lot of referctoring, improvements.
>     * Thread safe.
>     * New APIs for gettext/tools instead of gettext/utils.
> * gettext_activerecord-2.0.0
>     * Support activerecord-2.3.2.
> * gettext_rails-2.0.0
>     * Support Rails-2.3.2.
>     * Work with other I18n backends.
>
> (NOTE)
>   * Rails-2.3.1 and earlier aren't supported.
>
> Thanks to
> ---
> Special Thanks to:
>   Michael Grosser: A lot of improvement.
>
> Thanks to:
>   Tietew, Kazuhiro NISHIYAMA,  Fabio M.A.
>   Tuptus, Morus Walter, Vladimir Dobriakov, Ramsey.
>
> Website
> ---
> * homepage
>    http://www.yotabanana.com/hiki/ruby-locale.html
>    http://www.yotabanana.com/hiki/ruby-gettext.html
> * rubyforge
>    http://rubyforge.org/projects/locale
>    http://rubyforge.org/projects/gettext
> * github
>  http://github.com/mutoh/locale/tree/master
>  http://github.com/mutoh/locale_rails/tree/master
>  http://github.com/mutoh/gettext/tree/master
>  http://github.com/mutoh/gettext_activerecord/tree/master
>  http://github.com/mutoh/gettext_rails/tree/master
>
> * Download
>  http://rubyforge.org/frs/?group_id=855&release_id=2856
>  http://rubyforge.org/frs/?group_id=1997&release_id=32471
>
> * Ruby-GetText-Package HOWTOs
>  http://www.yotabanana.com/hiki/ruby-gettext-howto.html
> * Ruby-GetText-Package HOWTO for Ruby on Rails
>  http://www.yotabanana.com/hiki/ruby-gettext-rails.html
> * HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)
>  http://www.yotabanana.com/hiki/ruby-gettext-rails-migration.html
> * Ruby-GetText-Package documents for Translators
>  http://www.yotabanana.com/hiki/ruby-gettext-translate.html
>
> What's this?
> -
> Ruby-GetText-Package is a Localization(L10n) library and tool
> which is modeled after the GNU gettext package.
>
> This library translates original messages to localized
> messages using client-side locale information(environment
> variable, using system locale API or CGI variable).
>
> The tools for developers support creating, useing, and modifying
> localized message files(message catalogs).
>
> ScreenShots
> ---
> Screenshots in 23 languages (Sample Rails blog) 
> are:http://www.yotabanana.com/hiki/?ruby-gettext-screenshot
>
> --
> Masao Mutoh 
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Philip Hallstrom


On Mar 23, 2009, at 5:09 PM, Bharat Ruparel wrote:

>
> I am trying to monkey-patch the ActiveRecord::Base class to  
> incorporate
> a generic search class method so that it can be used by all model
> classes which need this functionality.  Since model classes directly
> inherit from ActiveRecord::Base and unlike controllers and helpers, do
> not have an ancestor class defined, I think I am forced to open the
> ActiveRecord::Base class and patch it?  May be I am wrong.  Anyway,  
> here

Why not create your method as a module and then include it into the  
classes you need it?  Look at any of the plugins out there that are of  
the "acts_as_" variety which add methods to the model they are  
called from... just follow those examples and you shouldn't need to  
directly modify AR::Base like this.


> is my code in the active_record_extensions.rb file that I created in  
> the
> RAILS_ROOT/lib directory:
>
> module ActiveRecord
>
>  class Base
>def self.search(search, current_page)
>  if search.blank?
>paginate(:all, :page => current_page || 1, :per_page => 5)
>  else
>paginate(:all, :conditions => ["name LIKE ?", "%#{search}%"],
> :order => 'name',
>  :page => current_page || 1, :per_page => 5)
>  end
>end
>  end
>
> end
>
> Note that paginate method comes from the will_paginate plugin  
> installed
> in vendor/plugins directory.
>
> This does not work.  My program is having trouble with the paginate
> method from will_paginate plugin being called in the code shown above?
>
> This seems to be a load_path issue?  One way to solve this is to  
> install
> will_paginate as a gem and then require it before calling paginate?   
> But
> is there a way to make with work as a plugin as I have it currently  
> for
> creating this generic routine?
>
> Thanks for your time in advance.
>
> Bharat
> -- 
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: From Rails 1.2.6 to 2.3.2

2009-03-23 Thread Craig Demyanovich
1. Upgrade to latest 2.0.x release, run all of your tests, fix any failures,
address any deprecations.
2. Upgrade to latest 2.1.x release, run all of your tests, fix any failures,
address any deprecations.
3. Upgrade to latest 2.2.x release, run all of your tests, fix any failures,
address any deprecations.
4. Upgrade to latest 2.3.x release, run all of your tests, fix any failures,
address any deprecations.

You may need to upgrade plugins and/or other tools at one or more steps,
too. I know it seems like a long recipe, but it should keep the problems to
a minimum along the way.

Regards,
Craig

On Mon, Mar 23, 2009 at 7:03 PM, elle  wrote:

>
> Hello,
>
> I have an application I did in 2007 in Rails 1.2.6. It was my first
> one -- so I am sure the code could be improved and better refractored.
> If I wanted to upgrade the application to 2.3.2 and hopefully improve
> it -- how would you suggest I tackle this? Any advice would be great.
>
> Elle
> >
>


-- 
Craig Demyanovich
Mutually Human Software
http://mutuallyhuman.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Bharat Ruparel

I am trying to monkey-patch the ActiveRecord::Base class to incorporate
a generic search class method so that it can be used by all model
classes which need this functionality.  Since model classes directly
inherit from ActiveRecord::Base and unlike controllers and helpers, do
not have an ancestor class defined, I think I am forced to open the
ActiveRecord::Base class and patch it?  May be I am wrong.  Anyway, here
is my code in the active_record_extensions.rb file that I created in the
RAILS_ROOT/lib directory:

module ActiveRecord

  class Base
def self.search(search, current_page)
  if search.blank?
paginate(:all, :page => current_page || 1, :per_page => 5)
  else
paginate(:all, :conditions => ["name LIKE ?", "%#{search}%"],
:order => 'name',
  :page => current_page || 1, :per_page => 5)
  end
end
  end

end

Note that paginate method comes from the will_paginate plugin installed
in vendor/plugins directory.

This does not work.  My program is having trouble with the paginate
method from will_paginate plugin being called in the code shown above?

This seems to be a load_path issue?  One way to solve this is to install
will_paginate as a gem and then require it before calling paginate?  But
is there a way to make with work as a plugin as I have it currently for
creating this generic routine?

Thanks for your time in advance.

Bharat
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails making it tougher for newbies?

2009-03-23 Thread GS

I would highly recommend

"ruby for rails" as a starter book
followed by
"The Rails Way" for Rails 2.0 as an excellent definitive source on
most topics.

-gs

On Mar 21, 5:12 pm, Power One 
wrote:
> I'm trying to learn how to use ruby on rails.  Just two weeks ago I'm
> learning how to program in Ruby, but now I'm ready to get onto with
> rails.  I got a book for rails but it shows me rails examples that only
> work with rails 1.2.3.  I follow the examples, but many are not working.
> For example, scaffold is not working with 2.1.0 (rails version install
> in my computer.
>
> My question is, how do you go about scaffold in rails 2.1.0?  Some
> pagination is not working out of the box such as will_pagination and
> classic_pagination.  Ubuntu 8.10 is making rails more difficult, and
> installing will_pagination from gems didn't do the trick.
>
> Anyone know a complete tutorial that teaches how to install all
> necessary gems/plugins/debian packages that will help me smooth-sailing
> in my ruby on rails adventure?  Thank You.
>
> Also I couldn't find a good beginning ruby on rails book that is
> up-to-date, and I know ruby on rails is a very fast moving framework as
> ruby is also a very fast moving programming language -- things are
> changing constantly for the better.  Any guide to better rails way?
>
> 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-talk@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] From Rails 1.2.6 to 2.3.2

2009-03-23 Thread elle

Hello,

I have an application I did in 2007 in Rails 1.2.6. It was my first
one -- so I am sure the code could be improved and better refractored.
If I wanted to upgrade the application to 2.3.2 and hopefully improve
it -- how would you suggest I tackle this? Any advice would be great.

Elle
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Complex Query?

2009-03-23 Thread Party Drone

Here's what I ended up doing, and it works out as expected:

http://gist.github.com/83829

On Mar 23, 12:03 pm, Party Drone  wrote:
> Still haven't quite figured this out…
>
> On Mar 20, 5:09 pm, Party Drone  wrote:
>
>
>
> > I think I have a start with this:
>
> > DownloadType.all(:include => :downloads, :joins => [:downloads
> > => :products], :conditions => ['product.id = ?', id], :order =>
> > 'position, download.title')
>
> > But I get the following error:
>
> > SQLite3::SQLException: ambiguous column name: downloads.id: SELECT
> > "download_types"."id" AS t0_r0, "download_types"."name" AS t0_r1,
> > "download_types"."position" AS t0_r2, "download_types"."created_at" AS
> > t0_r3, "download_types"."updated_at" AS t0_r4, "downloads"."id" AS
> > t1_r0, "downloads"."title" AS t1_r1, "downloads"."part_number" AS
> > t1_r2, "downloads"."download_type_id" AS t1_r3,
> > "downloads"."created_at" AS t1_r4, "downloads"."updated_at" AS t1_r5,
> > "downloads"."download_file_name" AS t1_r6,
> > "downloads"."download_content_type" AS t1_r7,
> > "downloads"."download_file_size" AS t1_r8,
> > "downloads"."download_updated_at" AS t1_r9 FROM "download_types" LEFT
> > OUTER JOIN "downloads" ON downloads.download_type_id =
> > download_types.id INNER JOIN "downloads" ON downloads.download_type_id
> > = download_types.id INNER JOIN "downloads_products" ON
> > "downloads_products".download_id = "downloads".id INNER JOIN
> > "products" ON "products".id = "downloads_products".product_id WHERE
> > (product.id = 58) ORDER BY position, download.title
>
> > I think I'm almost there…
>
> > On Mar 20, 3:47 pm, partydrone  wrote:
>
> > > I need to perform a Rails find with the following data model in my
> > > controller:
>
> > > download_types  -->  downloads  -->  downloads_products  <--  products
>
> > > I want to grab all downloads for a given product_id and list them by
> > > download type. Download types is a sortable list (using a position
> > > column in the table, and I want to make sure the download types are
> > > sorted by that column). I'm thinking of something like this:
>
> > > DownloadType.all(:include => :downloads, :conditions => ['product.id
> > > = ?', params[:id]], :order => 'position, download.title')
>
> > > I'm trying to figure out what to put in the middle, some sort
> > > of :joins clause, but I'm not sure how it should look. In my view, it
> > > seems the most logical to me to start looping through download types,
> > > then loop through downloads for the given download type.
>
> > > Any suggestions?
>
> > > 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rails's models diagrams

2009-03-23 Thread Isaac Amaru Zelaya Orellana
>
> Thanks a lot i will try
>

-- 
GOOOL!!!

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



[Rails] Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?

2009-03-23 Thread bornboulde...@gmail.com

Spec::Rails people,
I'm curious about:
  - model.should have(1).error_on(:attribute)
displayed in the URL below:
  http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Exten...
The Rspec peepcode screencast suggests that
model.should have(1).error_on(:attribute)
should pass if
model.send(:attribute)
returns nil
For me, I get an exception from the rspec script.
My work-around is simple.
Instead of:
  - model.should have(1).error_on(:attribute)
I Use:
  -model.send(:attribute).should be_nil
But now I have the question:
  - What kind of error causes:
- model.should have(1).error_on(:attribute)
- to pass ??
--b
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: find :all using :group

2009-03-23 Thread Ayeye Brazov


>> However, I wonder if it could be done within the "find" method ?
> 
> Not really. By definition if you group using the database then you
> only get back one row for each value of the grouped column  - that's
> just what group does in database and you want something else.
> 
> Fred

I see, thanks for that Fred.

Thanks all for the replies
a.


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



[Rails] Re: Cannot set date value

2009-03-23 Thread Frederick Cheung



On Mar 23, 9:31 pm, James Byrne 
wrote:
> I have this controller code:
>  ...
>       field_array.each do |f|
>         f = f.to_sym
>         model.send("#{f}=", "#{parm_hash[f]}") if
> model.attribute_present?(f)
>       end
>       return model
> ...
>
> field_array is an array of attribute names as strings.
> parm_hash is the params hash returned from the view associated with
> model.
>
> If the value associated with an attribute_key is anything but a date
> then this works and the value is set.  If the value is a date then it
> sets nil instead.
>
because with a date you can't pull the value from the params hash in
one go like that - there is one value in the hash for each component
(day, month, year). There's more about this at
http://www.spacevatican.org/2008/12/3/dates-params-and-you

Fred
> Can anyone see what I am doing wrong?
> --
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] error while running "rails shovell"

2009-03-23 Thread michalyad

I have just installed rails thru Curt Hibbs installment file
(InstantRails 1.3a zip).
I am trying to create the required directories for a demo application
named "shovell".
I opened the ruby console and I ran "rails shovell"

I get the following errors.

"C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport -2.3.2/lib/
active_support/vendor.rb:5: undefined method 'gem' for
main:object ,noMethodError>
from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:21:in 'require'
from c:/" ...etc

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



[Rails] rails boolean and mysql tinyint(1) question?

2009-03-23 Thread VSG

this may seem silly but i just noticed that if in mysql the column
which is a tinyint(1) happens 2 or greater, by a chance of glitch or
corruption in the database(i did it manually ofcourse but i am
speaking hypothetically), rails would see it as false. but i find that
really wrong seeing how in mysql it sees any non-zeroes as true.

i really think if it does happen to be any number other than 1 or 0 it
should throw an exception saying the data is corrupted or something
because rails should only return 0 or 1. am i crazy for thinking like
this?

also can somebody point to me where in the code it does the tinyint(1)
to boolean conversion? or could that possibly be a mysql thing?

thx,
VSG

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



[Rails] Cannot set date value

2009-03-23 Thread James Byrne

I have this controller code:
 ...
  field_array.each do |f|
f = f.to_sym
model.send("#{f}=", "#{parm_hash[f]}") if
model.attribute_present?(f)
  end
  return model
...

field_array is an array of attribute names as strings.
parm_hash is the params hash returned from the view associated with
model.

If the value associated with an attribute_key is anything but a date
then this works and the value is set.  If the value is a date then it
sets nil instead.

Can anyone see what I am doing wrong?
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: conditional model validation

2009-03-23 Thread Frederick Cheung

On Mar 23, 8:26 pm, jzimmek  wrote:
>
> u = User.new
> u.address = Address.new
> u.save
>
> NoMethodError: You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.needs_street_validation?
>         from app/models/address.rb:3
>
> seems to me like we cannot reference any associated object within the
> ":if" condition or do you know some trick to get this working ?
>
The problem isn't anything to do with :if's, more a general quirk of
activerecord - When you assign Address.new to u.address activerecord
doesn't update the inverse assocation on the address object. In the
case where you're doing this with already saved objects you can use
tricks like set_#{association_name}_target to do that work of filling
in the inverse association, though I don't know if  the fact that your
objects are unsaved makes a difference.


Fred





> maybe this is not the best example, but i hope you got the point.
>
> in most more-complex gui's we have conditional validation based on the
> state of multiple objects. It would be a shame if we could only handle
> those validation programmatically.
>
> tested in a vanilla rails 2.3.2 application.
>
> any help would be really appreciated.
>
> regards
> jan
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Dynamically generated form + Saving multiple records at once

2009-03-23 Thread Marcelo Ruiz

This is a code sample of what I have made so far:

New Report for <%= @way.road.name%>, <%= @way.name%>

<%= form_tag :action => :create, :id => @way.id%>

Date: <%= datetime_select("report", "time") %> 

Priority:
<%= radio_button("report", "priority", 1) %> high -
<%= radio_button("report", "priority", 2, {:checked => "checked"})
%>  medium -
<%= radio_button("report", "priority", 3) %> low

<% for segment in @segments%>

<%= hidden_field("report[]", "segment_id", { :value =>
segment.id}) %>

Segment: <%= segment.name%>

Traffic Status:
<%= select("report[]", "status_id", Status.find(:all, :order
=> "Severity").map {|u| [u.name, u.id]}) %>


Description:
<%= text_area("report[]", "description", {:rows => 6, :cols =>
70}) %>

Short Desc.:
<%= text_area("report[]", "short_description", {:rows =>
2, :cols => 70}) %>

<% end %>

<%= submit_tag %>



This form renders well. Notice how I have some fields of Report that
are common to all segment reports (Hour and Priority) and some that
vary (segment_id, status_id, description and short_description). I'm
prefixing the first fields with "report" and the others with "report
[]". I'm not sure if it's a good idea.

Now I don't have any idea how I should handle this in the controller.

Any idea?

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



[Rails] GSoC applications open today

2009-03-23 Thread Jeremy Kemper

Google Summer of Code student applications start today!

College students: follow your open source passion this summer and let
Google foot the bill. Google Summer of Code (GSoC) is a global program
that offers student developers stipends to write code for various open
source software projects.

RubyCentral didn't make it in as a mentoring organization this year,
so Rails is opening the gates to any project in the broader Ruby
ecosystem rather than solely Rails development. We will prefer strong
Rails applicants if the pool of dedicated, energetic mentors is too
small to give all projects the attention they deserve.

So Rubyists, step up! Please consider mentoring a student this summer.
It's a significant responsibility (estimate 5 hours/week) but mutually
rewarding and immensely beneficial to the community at large. Sign up
at the GSoC site [1] and join the discussion in the GSoC Campfire room
[2].

Students, now's the time to brainstorm and come up with a summer
project you feel passionate about. Check out and contribute to the
ideas list on the Rails wiki [3], start a discussion on the Rails core
list [4], and chat with mentors in the GSoC Campfire room [2]. Come up
with a concrete, attainable set of goals for the summer, and start
writing up an application [5]. You can work on your application from
now until the deadline, April 3 [6].

Best regards, and good luck!
jeremy

[1] http://socghop.appspot.com/mentor/request/google/gsoc2009/rails
[2] https://rails.campfirenow.com/33511
[3] http://wiki.rubyonrails.org/gsoc/2009/ideas
[4] http://groups.google.com/group/rubyonrails-core
[5] http://socghop.appspot.com/student/apply/google/gsoc2009
[6] http://socghop.appspot.com/document/show/program/google/gsoc2009/timeline

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



[Rails] Re: Dynamically generated form + Saving multiple records at once

2009-03-23 Thread Marcelo Ruiz

Thank you Freddy. That wasn't exactly what I needed to do, but the
screencasts helped me in another case.

What I actually need to do is simpler: create multiple Reports at the
same time. Each report has a description with a textfield and I have
to associate it with a different segment. That's all.

Any help? Thanks!

On 21 mar, 10:55, Freddy Andersen  wrote:
> I think you will be happy to watch this screencast
>
> http://railscasts.com/episodes/75-complex-forms-part-3
>
> Its a project that has_many tasks but it talks about exactly the
> problem you have with build_segments 3.times...
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] conditional model validation

2009-03-23 Thread jzimmek

i really like the declarative model-based validation in rails, but i
run into trouble while doing some real world (more complex) stuff.

class User < ActiveRecord::Base
  belongs_to :address
  accepts_nested_attributes_for :address
  def needs_street_validation?
true
  end
end

class Address < ActiveRecord::Base
  has_one :user
  validates_presence_of :street, :if => Proc.new { |adr|
 adr.user.needs_street_validation? }
end

u = User.new
u.address = Address.new
u.save

NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.needs_street_validation?
from app/models/address.rb:3


seems to me like we cannot reference any associated object within the
":if" condition or do you know some trick to get this working ?

maybe this is not the best example, but i hope you got the point.

in most more-complex gui's we have conditional validation based on the
state of multiple objects. It would be a shame if we could only handle
those validation programmatically.

tested in a vanilla rails 2.3.2 application.

any help would be really appreciated.

regards
jan
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: InstantRails and new gems

2009-03-23 Thread jemminger

perhaps you need

  require 'wxruby2'

in your code?  or maybe

  require 'rubygems'
  require 'wxruby2'


On Mar 23, 1:08 am, Pierre Pierre 
wrote:
> Folks,
>
> I'm not sure this is the best place to ask the following question, but
> someone might still know the answer.
>
> I currently can't install anything on this computer (hence no ruby
> interpreter), I thought about getting InstantRails with which you can
> open a console with ruby running.
> I also wanted to add a new gem (wxruby2), I could install the gem
> correctly but when I run my code, it'll tell me: no such file to load --
> wxruby2 (LoadError)
>
> Anyone has an idea how I can install (and use) new gems with
> InstantRails?
>
> Cheers
> --
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Where is the sqlite .db file?

2009-03-23 Thread Vince Gilbert

Bosko Ivanisevic wrote:
> First look at your config/database.yml. In newly created rails
> application you'll find location of your database file for all three
> environments (development, test and production). But this will not
> create your database. In order to create it run:
> 
> rake db:create
> 
> After that you'll find your database file in db folder (if you didn't
> change database.yml). For complete list of rake tasks run:
> 
> rake -T
> 
> On Mar 23, 1:50?pm, Vince Gilbert 

Thank you very much for your replies.  My application is up and running 
with data in it.  I just couldn't find the database.  I want to go in 
and and a few columns and some more records.

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



[Rails] Re: Where is the sqlite .db file?

2009-03-23 Thread Bosko Ivanisevic

First look at your config/database.yml. In newly created rails
application you'll find location of your database file for all three
environments (development, test and production). But this will not
create your database. In order to create it run:

rake db:create

After that you'll find your database file in db folder (if you didn't
change database.yml). For complete list of rake tasks run:

rake -T

On Mar 23, 1:50 pm, Vince Gilbert 
wrote:
> Hi all,
>
> I've been reading a ton, doing tutorial, and generally trying to learn
> Ruby on Rails.
>
> I have a question that I haven't been able to find the answer to.
>
> Where is the .db file that sqlite3 creates for Rails projects?  I can't
> for the life of me figure out how to access the database tables.  I even
> downloaded a few sqlite GUI tools, but when they ask me which db file
> I'd like to open, I can't find one anywhere.  I even did a full search
> on my c: for *.db*
>
> Thanks for your help,
>
> Vince
> --
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: find :all using :group

2009-03-23 Thread Party Drone

User.find(:all, :order => 'os')

:order sorts ascending by default.  You can define the sort order
explicitly with ASC or DESC (i.e., 'os ASC' or 'os DESC').


On Mar 23, 8:21 am, Ayeye Brazov 
wrote:
> hello,
>
> I need to group Users depending on their operating systems field "os",
> so I tried
>
> User.find(:all, :group => :os)
>
> however, the result is an array having only one user for each os group.
> I'd like to have ALL the users grouped  by :os though
>
> One solution is to write
>
> User.find(:all).group_by{|u| u.os}
>
> However, I wonder if it could be done within the "find" method ?
>
> 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-talk@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: Rails making it tougher for newbies?

2009-03-23 Thread Jason Arora

Lots of good advice so far... I would also recommend checking out
Railscasts.com. Ryan Bates offers great Rails instructional videos for
free.

Really, the best way to learn is to just immerse yourself: start
building a blog or web application, watch Rails videos everyday, and
learn a different Ruby construct every other day.

On Mar 22, 9:53 am, Hugh Themm  wrote:
> Hi there, I know it can be frustrating, even for those of us that have
> been in it for a while.  (freezing the environment is a real chore)/
>
> My suggesting is to forgo the print books and go straight to
> peepcode.com and the pragmatic programmers(http://www.pragprog.com/
> titles/rails3/agile-web-development-with-rails-third-edition) sites
> and watch the up-to-date screen casts and buy the pdfs.
>
> The great part about rails is it's agility, and that works both
> ways.
>
> My suggestion is also to really learn the ruby language and the rest
> will follow.
>
> On Mar 21, 5:12 pm, Power One 
> wrote:
>
> > I'm trying to learn how to use ruby on rails.  Just two weeks ago I'm
> > learning how to program in Ruby, but now I'm ready to get onto with
> > rails.  I got a book for rails but it shows me rails examples that only
> > work with rails 1.2.3.  I follow the examples, but many are not working.
> > For example, scaffold is not working with 2.1.0 (rails version install
> > in my computer.
>
> > My question is, how do you go about scaffold in rails 2.1.0?  Some
> > pagination is not working out of the box such as will_pagination and
> > classic_pagination.  Ubuntu 8.10 is making rails more difficult, and
> > installing will_pagination from gems didn't do the trick.
>
> > Anyone know a complete tutorial that teaches how to install all
> > necessary gems/plugins/debian packages that will help me smooth-sailing
> > in my ruby on rails adventure?  Thank You.
>
> > Also I couldn't find a good beginning ruby on rails book that is
> > up-to-date, and I know ruby on rails is a very fast moving framework as
> > ruby is also a very fast moving programming language -- things are
> > changing constantly for the better.  Any guide to better rails way?
>
> > 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-talk@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: find :all using :group

2009-03-23 Thread Eric

On Mar 23, 11:38 am, Frederick Cheung 
wrote:
> On Mar 23, 2:21 pm, Ayeye Brazov 
> wrote:
>
> > User.find(:all, :group => :os)
>
> > however, the result is an array having only one user for each os group.
> > I'd like to have ALL the users grouped  by :os though
>
> > One solution is to write
>
> > User.find(:all).group_by{|u| u.os}
>
> > However, I wonder if it could be done within the "find" method ?
>
> Not really. By definition if you group using the database then you
> only get back one row for each value of the grouped column  - that's
> just what group does in database and you want something else.

...such as :order => 'os ASC'
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: mysql encoding with rails 2.3.2 and ruby 1.9.1

2009-03-23 Thread Conrad Taylor
On Mon, Mar 23, 2009 at 10:16 AM, Stefan La <
rails-mailing-l...@andreas-s.net> wrote:

>
> Jeremy Kemper wrote:
> > On Sat, Mar 21, 2009 at 7:52 AM, ruby.freeman 
> > wrote:
> >>
> >> when I run console with ruby 1.9.1 and rails 2.3.2, and trying to do
> >> something like
> >>
> >> User.first.name.encoding
> >>
> >> I'm getting #, though I've set "encoding: utf8"
> >> in database.yml
> >>
> >> any suggestions?
> >
> > The mysql driver is not encoding-aware yet.
> >
> > jeremy
>
> Same problem here with mysql and sqlite3.
>
> When will the mysql and sqlite3 drivers be encoding-aware?
>
> Is there a workaround?
>
> I have problems with this because I'm from germany and need utf8 for the
> german umlauts.
>
> If i save the templates as ANSI, the outputs from database with umlauts
> are working, but when i use umlauts directly in the templates i get this
> error:
>
> invalid byte sequence for encoding "ASCII-8BIT"
>
> If i save the templates as UTF8, the umlauts in the templates are
> working, but the outputs from the database with umlauts cause this
> error:
>
> invalid byte sequence for encoding "UTF-8"
>
>
> I'm using Ruby 1.9.1, Rails 2.3.2, mysql/ruby 2.8.1, sqlite3/ruby 1.2.4
>
> slang17


Your question should also be posted to driver maintainers and possible the
MySQL and SQLite projects.  Furthermore, all these projects are open-source.
Thus, please feel free to contribute/add these features if you need them.

Good luck,

-Conrad


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



[Rails] Re: Select updates database?

2009-03-23 Thread Frederick Cheung



On Mar 23, 6:14 pm, Amitabh A  wrote:
> I am running on Rails 2.2.2 on Solaris (and also on my mac) against
> mysql. For some reason, when I use a select in the partial, the
> database does not get updated with the changed value. I am using
> checkbox for other fields which works perfectly.
> I can provide more information if needed, but I would like the field
> to work as a dropdown instead of a text field.
>

ActiveScaffold expects things to be named in particular ways, I expect
the select box you've generated isn't created parameters named the way
it wants. You might be able to work out what the parameters should
look like by letting activescaffold generate what it wants (ie don't
use your partial) and seeing where the differences are. There's also
an activescaffold google group out there.

Fred
> My Model:
>       has_and_belongs_to_many :industries, :join_table =>
> "grant_loans_industry", :foreign_key =>
> "grant_loans_id", :association_foreign_key => "industry_id"
>       belongs_to :state
>
> My Controller:
>   before_filter :login_required
>
>   layout "admin"
>   active_scaffold :grant_loan do |config|
>     config.list.columns = [:agency, :gov_type, :title, :url]
>     config.columns.exclude  :state_name
>     config.label = 'Grants and Loans'
>     columns[:state].form_ui = :select
>     columns[:industries].form_ui = :select
>   end
>
> Partial:
>         <%=  select :grant_loan, :business_type, ['for_profit','non_profit'],
> {:selected => @record.business_type, :prompt => "Select The Business
> Type"}, {} %>
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to create the environment files for development, production and test?

2009-03-23 Thread Frederick Cheung



On Mar 23, 6:14 pm, gustavo  wrote:
> Hi,
>
> I have created the weblog in my house yesterday and uploaded to a
> SourceRepo svn repository. Today I started to work in other machine
> and checked out a version to another NetBeans. Somehow, the files
> inside the dir weblog/config/environments where not uploaded with svn
> yesterday: development.rb, production.rb and test.rb.
>
> I have no clue why? Somebody knows?
>
> I wonder if there is a Rack task to generate those files.
>
Well obviously you won't be able to get back any changes you made (eg
required gems) but if you just need the boilerplate, why not just
generate a fresh rails app and steal the files from there ?

Fred

> Thank you all!
> --
> Gustavo
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Deploy the Ruby Weblog tutorial

2009-03-23 Thread gustavo

Hi,

I am trying to deploy locally the application created in this
tutorial. But for normal apps, the apache doc root configuration
should point to the public directory. As the application doesnt have a
index inside the public, how should I config this?

Thanks!
Best Regards,

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



[Rails] Select updates database?

2009-03-23 Thread Amitabh A

I am running on Rails 2.2.2 on Solaris (and also on my mac) against
mysql. For some reason, when I use a select in the partial, the
database does not get updated with the changed value. I am using
checkbox for other fields which works perfectly.
I can provide more information if needed, but I would like the field
to work as a dropdown instead of a text field.

My Model:
  has_and_belongs_to_many :industries, :join_table =>
"grant_loans_industry", :foreign_key =>
"grant_loans_id", :association_foreign_key => "industry_id"
  belongs_to :state

My Controller:
  before_filter :login_required

  layout "admin"
  active_scaffold :grant_loan do |config|
config.list.columns = [:agency, :gov_type, :title, :url]
config.columns.exclude  :state_name
config.label = 'Grants and Loans'
columns[:state].form_ui = :select
columns[:industries].form_ui = :select
  end


Partial:
<%=  select :grant_loan, :business_type, ['for_profit','non_profit'],
{:selected => @record.business_type, :prompt => "Select The Business
Type"}, {} %>


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



[Rails] fleximage : help

2009-03-23 Thread senthil raja
hi dude

I am very much impressed on fleximage plugin functionality.
But practically facing many problem,

1.  By default it stores in png type, which takes more space. Is there any
way to upload a file in jpg format.
 Note: I know i can convert a file to jpg, by i want to convert at the
time of uploading itself.

2. formatted_image_path(@image, :jpg)
This will work only if the file upload file is in 'flat format'
By default i am getting files uploaded at nested folder structure but
while using formatted_image_path, its fetching like flat format
Any idea how to change 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] How to create the environment files for development, production and test?

2009-03-23 Thread gustavo

Hi,

I have created the weblog in my house yesterday and uploaded to a
SourceRepo svn repository. Today I started to work in other machine
and checked out a version to another NetBeans. Somehow, the files
inside the dir weblog/config/environments where not uploaded with svn
yesterday: development.rb, production.rb and test.rb.

I have no clue why? Somebody knows?

I wonder if there is a Rack task to generate those files.

Thank you all!
--
Gustavo

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



[Rails] Re: find :all using :group

2009-03-23 Thread Frederick Cheung



On Mar 23, 2:21 pm, Ayeye Brazov 
wrote:

> User.find(:all, :group => :os)
>
> however, the result is an array having only one user for each os group.
> I'd like to have ALL the users grouped  by :os though
>
> One solution is to write
>
> User.find(:all).group_by{|u| u.os}
>
> However, I wonder if it could be done within the "find" method ?

Not really. By definition if you group using the database then you
only get back one row for each value of the grouped column  - that's
just what group does in database and you want something else.

Fred
>
> 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-talk@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: find :all using :group

2009-03-23 Thread jemminger

This sounds right to me... find the SQL it generated in your .log and
execute it in a mysql console... is the output the same?


On Mar 23, 10:21 am, Ayeye Brazov 
wrote:
> hello,
>
> I need to group Users depending on their operating systems field "os",
> so I tried
>
> User.find(:all, :group => :os)
>
> however, the result is an array having only one user for each os group.
> I'd like to have ALL the users grouped  by :os though
>
> One solution is to write
>
> User.find(:all).group_by{|u| u.os}
>
> However, I wonder if it could be done within the "find" method ?
>
> 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-talk@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: Setting Session Options in Rails 2.3

2009-03-23 Thread tomrossi7

Have you tried using the following in your controller?

  session_options['cookie_only'] = false

I think that will work, I just don't know how to specify which methods
I want to apply the option.

On Mar 23, 6:04 am, hawkerb  wrote:
> I am having exactly the same problem. However, for me, old:
>
> class ImagesController < ApplicationController
>   session :cookie_only => false
> end
>
> does *not* work anymore. TomRossi7, can you double check does it work
> for you, please?
>
> The only way I worked this around, is to get sessions directly from
> SessionStore, which is extremely bad. Also I can't find tests
> regarding cookie_only option in 2.3.
>
> On Mar 23, 1:44 am, TomRossi7  wrote:
>
> > I'm trying to figure out how I should set my session options for Rails
> > 2.3.  In Rails 2.2:
>
> >   session :cookie_only => false, :only => :swf_upload
>
> > In Rails 2.3, it looks like I need to use:
>
> >   request.session_options['cookie_only'] = false
>
> > But how do I tell it that I only want that option on a specific method
> > in the controller (the :only option)?
>
> > Thanks!
> > Tom
>
> > p.s.  The old way works, but the deprecation warnings are driving me
> > nuts when I run my tests.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: mysql error on scoped find_or_create_by_attr

2009-03-23 Thread klochner

but the point is that it's a find_or_create, and the index is on
[:parent_id,:name],
so it should just find the record if it's a duplicate.

Also, the following worked:

Child.find_or_create_by_parent_id_and_name(1,"foobar")

On Mar 23, 2:10 pm, jemminger  wrote:
> The name 'foobar' exists already?
>
> On Mar 23, 1:36 pm, klochner  wrote:
>
> > Anyone have insight on this one?
>
> > class Parent
> >   has_many :children
> > end
>
> > add_index "children", ["parent_id", "name"], :name =>
> > "by_parent_name", :unique => true
>
> > a = Parent.find(1)
> > a.children.find_or_create_by_name "foobar"
>
> > Mysql::Error: Duplicate entry 'foobar' for key 2: INSERT INTO
> > `children` (`name`, `updated_at`,  `parent_id`, `created_at`) VALUES
> > ("foobar", '2009-03-23 17:25:39', 1,  '2009-03-23 17:25:39')
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ext_scaffold

2009-03-23 Thread ykazu714

Hello,everybody.
I started to use ext_scaffold recently, and I read this article,could
set up form.
http://jonathanbarket.com/post/78831424/simple-associations-with-ext-scaffold
But, I cannot search country name from manufacture form.
I want to attach file through ext_scaffold.

How can I solve them?

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



[Rails] Re: mysql error on scoped find_or_create_by_attr

2009-03-23 Thread jemminger

The name 'foobar' exists already?


On Mar 23, 1:36 pm, klochner  wrote:
> Anyone have insight on this one?
>
> class Parent
>   has_many :children
> end
>
> add_index "children", ["parent_id", "name"], :name =>
> "by_parent_name", :unique => true
>
> a = Parent.find(1)
> a.children.find_or_create_by_name "foobar"
>
> Mysql::Error: Duplicate entry 'foobar' for key 2: INSERT INTO
> `children` (`name`, `updated_at`,  `parent_id`, `created_at`) VALUES
> ("foobar", '2009-03-23 17:25:39', 1,  '2009-03-23 17:25:39')
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] My First Post

2009-03-23 Thread Edy Susanto

anything people know http://propertyind.blogspot.com/ look this one
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validation for a non active record input field

2009-03-23 Thread Rails List

pepe wrote:
> Hi there,
> 
> I've never done something like that but I can imagine you could do the
> validation in your controller. When the action is invoked you can
> check the values received in the params hash and act accordingly.
> 
> Pepe
> 
> On Mar 21, 12:42�pm, Rails List 

Thanks a million.  Worked as I wanted (how did I miss this approach?) 
:-)
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: mysql performance

2009-03-23 Thread Frederick Cheung


On 23 Mar 2009, at 17:44, Hans wrote:

>
> Rails mysql performance
>
> I have an application that reads an xml file, parse it and from there
> updates the database. My models has many associations and there are a
> lot of creation of new records  in the database. The performance is
> slow and my analyses shows that  mysql is to blame.
>
> In a separate test it took about 11 seconds to create 100 records, i.e
> 0.1 sec for each record.
> Is that normal for the development mode?

If it's inside a single action development mode isn't going to be  
slower once it's reloaded your models' code and so on.
Have you tried wrapping the insert inside a transaction ? If you don't  
then mysql has to flush to disk after each insert which can slow you  
down considerably.

Fred
>
>
> I develop on a new mac leopard with rails 2.2.2, ruby 1.8.6 and mysql
> Ver 14.12 Distrib 5.0.51a, for apple-darwin9.0.0b5 (i686) using
> readline 5.0.
>
> Any suggestions woul be appreciated
> >


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



[Rails] Re: Complex Query?

2009-03-23 Thread Party Drone

Still haven't quite figured this out…

On Mar 20, 5:09 pm, Party Drone  wrote:
> I think I have a start with this:
>
> DownloadType.all(:include => :downloads, :joins => [:downloads
> => :products], :conditions => ['product.id = ?', id], :order =>
> 'position, download.title')
>
> But I get the following error:
>
> SQLite3::SQLException: ambiguous column name: downloads.id: SELECT
> "download_types"."id" AS t0_r0, "download_types"."name" AS t0_r1,
> "download_types"."position" AS t0_r2, "download_types"."created_at" AS
> t0_r3, "download_types"."updated_at" AS t0_r4, "downloads"."id" AS
> t1_r0, "downloads"."title" AS t1_r1, "downloads"."part_number" AS
> t1_r2, "downloads"."download_type_id" AS t1_r3,
> "downloads"."created_at" AS t1_r4, "downloads"."updated_at" AS t1_r5,
> "downloads"."download_file_name" AS t1_r6,
> "downloads"."download_content_type" AS t1_r7,
> "downloads"."download_file_size" AS t1_r8,
> "downloads"."download_updated_at" AS t1_r9 FROM "download_types" LEFT
> OUTER JOIN "downloads" ON downloads.download_type_id =
> download_types.id INNER JOIN "downloads" ON downloads.download_type_id
> = download_types.id INNER JOIN "downloads_products" ON
> "downloads_products".download_id = "downloads".id INNER JOIN
> "products" ON "products".id = "downloads_products".product_id WHERE
> (product.id = 58) ORDER BY position, download.title
>
> I think I'm almost there…
>
> On Mar 20, 3:47 pm, partydrone  wrote:
>
>
>
> > I need to perform a Rails find with the following data model in my
> > controller:
>
> > download_types  -->  downloads  -->  downloads_products  <--  products
>
> > I want to grab all downloads for a given product_id and list them by
> > download type. Download types is a sortable list (using a position
> > column in the table, and I want to make sure the download types are
> > sorted by that column). I'm thinking of something like this:
>
> > DownloadType.all(:include => :downloads, :conditions => ['product.id
> > = ?', params[:id]], :order => 'position, download.title')
>
> > I'm trying to figure out what to put in the middle, some sort
> > of :joins clause, but I'm not sure how it should look. In my view, it
> > seems the most logical to me to start looping through download types,
> > then loop through downloads for the given download type.
>
> > Any suggestions?
>
> > 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Mass Assginment and has_many others.build

2009-03-23 Thread James Byrne

Rails 2.3.2

This seems related specifically to the suffices _type and _value. 
Attributes ending in either of these strings are not processed by the 
attribute= method.  if #write_attribute("something_type", "a value") is 
called instead, then the somthing-type= method is again bypassed and the 
attribute is set to the literal value provided instead.

I have raised a ticket for this:

http://rails.lighthouseapp.com/projects/8994/tickets/2314-v-232-appropriates-attributed-ending-in-_type-and-_value

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



[Rails] mysql performance

2009-03-23 Thread Hans

Rails mysql performance

I have an application that reads an xml file, parse it and from there
updates the database. My models has many associations and there are a
lot of creation of new records  in the database. The performance is
slow and my analyses shows that  mysql is to blame.

In a separate test it took about 11 seconds to create 100 records, i.e
0.1 sec for each record.
Is that normal for the development mode?

I develop on a new mac leopard with rails 2.2.2, ruby 1.8.6 and mysql
Ver 14.12 Distrib 5.0.51a, for apple-darwin9.0.0b5 (i686) using
readline 5.0.

Any suggestions woul be appreciated
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] mysql error on scoped find_or_create_by_attr

2009-03-23 Thread klochner

Anyone have insight on this one?

class Parent
  has_many :children
end

add_index "children", ["parent_id", "name"], :name =>
"by_parent_name", :unique => true

a = Parent.find(1)
a.children.find_or_create_by_name "foobar"

Mysql::Error: Duplicate entry 'foobar' for key 2: INSERT INTO
`children` (`name`, `updated_at`,  `parent_id`, `created_at`) VALUES
("foobar", '2009-03-23 17:25:39', 1,  '2009-03-23 17:25:39')
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: mysql encoding with rails 2.3.2 and ruby 1.9.1

2009-03-23 Thread Stefan La

Jeremy Kemper wrote:
> On Sat, Mar 21, 2009 at 7:52 AM, ruby.freeman  
> wrote:
>>
>> when I run console with ruby 1.9.1 and rails 2.3.2, and trying to do
>> something like
>>
>> User.first.name.encoding
>>
>> I'm getting #, though I've set "encoding: utf8"
>> in database.yml
>>
>> any suggestions?
> 
> The mysql driver is not encoding-aware yet.
> 
> jeremy

Same problem here with mysql and sqlite3.

When will the mysql and sqlite3 drivers be encoding-aware?

Is there a workaround?

I have problems with this because I'm from germany and need utf8 for the 
german umlauts.

If i save the templates as ANSI, the outputs from database with umlauts 
are working, but when i use umlauts directly in the templates i get this 
error:

invalid byte sequence for encoding "ASCII-8BIT"

If i save the templates as UTF8, the umlauts in the templates are 
working, but the outputs from the database with umlauts cause this 
error:

invalid byte sequence for encoding "UTF-8"


I'm using Ruby 1.9.1, Rails 2.3.2, mysql/ruby 2.8.1, sqlite3/ruby 1.2.4

slang17
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Emailing

2009-03-23 Thread LaughingNinja

Try adding this to your mailer model:

ActionMailer::Base.delivery_method = :sendmail

Gary.

On Mar 21, 11:36 pm, Shelly  wrote:
> Hi,
>
> I am trying to send emails out using ActionMailer.  Currently, the
> console shows that everything is sending out correctly, but I am not
> actually receiving any emails.
>
> Thanks in advance,
>
> Shelly
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Mass Assginment and has_many others.build

2009-03-23 Thread James Byrne

Typically, when one creates a has_many associated table one does this:

hasone.hasmany.build({attribute hash},{attribute hash},..} or
hasone.hasmany.create({attribute hash}, ...

However, if mass assignment is turned off (attr_accessible => nil), then
I cannot seem to set the attributes directly.

For example, in a console session I do this:

>> me = Entity.new
=> ...
>> me.attribute = ...
...
>> me.save!
=> true
>> mi = me.identifiers.build
=> ...
>> mi.entity_id
=> 1
>> mi.identifier_type = 'post'
=> 'post'
>> mi.identifier_type
=> nil

What is going on and how do I directly set association attributes?
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Bounding width when we give users' TinyMCE or FCKEditor?

2009-03-23 Thread Freddy Andersen

What I have is something like this in my css:

.post-message {
word-break: break-all;
}

That does it for me...
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Just how the hell do you set Cache-Control max-age?

2009-03-23 Thread Michael Graff

I would probably set this in the web front-end (apache, etc)  This is
where I do expires stuff.  I have to be careful though since most of
the examples I've seen literally say to set it globally, but Rails
uses the public directory for caching as well.

For max age, I'd consider having Apache set it, so it will also be set
for cached files, if you use any caching.

--Michael


On Mon, Mar 23, 2009 at 7:49 AM, Petr Janda
 wrote:
>
> Hi all,
>
> Ive been googling for couple of hours and I just cant figure it out. I
> want to set the max-age value to 300 for the WHOLE application,
> regardless of development or production mode.
>
> Is there anyone that knows?
>
> Petr
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



-- 
(Ruby, Rails, Random) blog:  http://skandragon.blogspot.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] You can speak Indonesia

2009-03-23 Thread Edy Susanto

Now, i will teach you with my basic langguage...
let start to learn more about Indonesia
Saya = I,me
Kamu = You
Kita = Our
Mereka = They
Cinta = Love

and

Saya cinta kamu
I love you

More learn Indonesia
visit here

http://propertyind.blogspot.com/
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] JOBS: RoR Developer

2009-03-23 Thread Craig

Hello Everyone,

I am an executive recruiter in Toronto, one of my long standing
clients have recently retained me to find a Rails developer.  I have
included the posting below and please respond to me if you have
interest.   Please note: this is  a full time permanent role and
offers six weeks paid vacation.   Thanks for your time and have a
great day!!

Rails Developer


Our client, a North American leader in the development and training of
business owners, is looking to expand their web development team with
the addition of a RoR developer.  With over 20 years in business, our
client has offices in Toronto & Chicago and offers a high energy and
progressive culture.


Core Responsibilities:

Development of various websites and a custom CRM solution

Skills Required:

-Team oriented with strong communication skills
-Ability to wear multiple hats
-Data modeling and OO design knowledge and practice
-Working knowledge of MVC design patterns
-History of rails based applications
-History of application development
-Comfortable with source code control (subversion)
-Comfortable with basic web server configuration and deployment
-Strong SQL Skill Set


Technical Experience

-Strong Ruby on Rails experience is preferred
-Strong *nix command line experience
-Working within high availability environments
-Comfortable with MAC OS X
-Test/Behaviour driven development


Compensation:

A full-time permanent role, offering competitive salary & bonus,
benefits, and six weeks vacation.

For further information, call/email resume to either/or:

Craig Alexander
Feldman Daxon Partners, Inc.
(416) 515-7600 ext. 231
calexan...@feldmandaxon.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails 2.3 Nested models

2009-03-23 Thread JonMagic

Yeah, thanks, I did end up finding that and it has been helpful...

On Mar 22, 10:04 pm, JL Smith  wrote:
> This should get you going...also check out the links at the end under
> "Resources".
>
> http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nest...
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Look This One

2009-03-23 Thread Edy Susanto

how do you think about my simple blog, please give your opinion for my
new
blog

visit here http://propertyind.blogspot.com/
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Helper

2009-03-23 Thread JL Smith

Another similar method...

def show_flash
[:notice, :warning, :message].collect do |key|
  content_tag(:div, flash[key], :class => "flash_#{key}") unless
flash[key].blank?
end.join
end
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Bounding width when we give users' TinyMCE or FCKEditor?

2009-03-23 Thread InventoryTrackers

I finally got TinyMCE to work beautifully and now am trying to
understand how I will bound my users' from not pushing the HTML beyond
the borders that I grant them.

For example, if I type;

9

It goes off the edge of the  space I have defined for this
element.
Is there a way to still grant them the HTML they produced as a result
of using this editor and keep them from going off the edge?

Thanks,
David
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Helper

2009-03-23 Thread Freddy Andersen

Or something like this:

  def flash_messages
messages = []
%w(notice warning error).each do |msg|
  messages << content_tag(:div, html_escape(flash
[msg.to_sym]), :id => "flash-#{msg}") unless flash[msg.to_sym].blank?
end
messages
  end

<%= flash_messages %>


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



[Rails] find :all using :group

2009-03-23 Thread Ayeye Brazov

hello,

I need to group Users depending on their operating systems field "os",
so I tried

User.find(:all, :group => :os)

however, the result is an array having only one user for each os group.
I'd like to have ALL the users grouped  by :os though

One solution is to write

User.find(:all).group_by{|u| u.os}

However, I wonder if it could be done within the "find" method ?

thanks
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Where is the sqlite .db file?

2009-03-23 Thread Frederick Cheung



On Mar 23, 12:50 pm, Vince Gilbert 
wrote:
> Hi all,
>
> I've been reading a ton, doing tutorial, and generally trying to learn
> Ruby on Rails.
>
> I have a question that I haven't been able to find the answer to.
>
> Where is the .db file that sqlite3 creates for Rails projects?  I can't
> for the life of me figure out how to access the database tables.  I even
> downloaded a few sqlite GUI tools, but when they ask me which db file
> I'd like to open, I can't find one anywhere.  I even did a full search
> on my c: for *.db*

Normally they're in your_app/db and have the extension .sqlite3

Fred
>
> Thanks for your help,
>
> Vince
> --
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Ajax not defined.

2009-03-23 Thread Frederick Cheung



On Mar 23, 12:52 pm, Intern ruby 
wrote:
> This is my code and I am trying to call remote function when somebody
> click on add button after selecting something from select_tag. Please
> tell me where I am wrong ? I am getting following error: Ajax not
> defined.

Probably means that your page doesn't load the prototype javascript
library (which is the thing that adds the Ajax object). See
javascript_include_tag

Fred
>
> 
>
> <%= select_tag 'available_line_id[]',options_for_select(customers),{:id
> => 'available_line_id',:multiple => true, :size => 13, :style => 'width:
> 225px;'} %>
>
> Thanks,
>
> Attachments:http://www.ruby-forum.com/attachment/3475/new.html.erb
>
> --
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] to avoid blank page

2009-03-23 Thread geetha

In Jasper Reports,I am having one parameter,thats
Receipttype ..Receipt tyape mean Manifest,Nonmanifest,Both.f i gave
manifest Mean Maniefst datas will be printed and,if i gave Nonmanifest
mean nonmanifest datas will be printed and if i gave Both mean
Manifest and Nonmanifest datas will be printed.I called both reports
in main reports,In this palce i gave Receipt typa as both mean,here
manifest datas will be printed in 2 pages and Nonmanifest will be
printed as next page,so here i gave split allowed option as false but
in this place manifest datas is not coming mean it will printed as
Blank page.I want to avoid this blank page.please reply to my question.

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



[Rails] Re: Helper

2009-03-23 Thread anton effendi
add one def in application_helper.rb
like :

 def show_flash(flash)
   html = ""
if flash[:error]
  html += "#{flash[:error]}"
end
   if flash[:warning]
 html + = "#{flash[:warning]}"
   end
   if flash[:notice]
 html += "#{flash[:notice]}"
   end
 end

then change in view.
  from
 <% if flash[:error] %>
   <%= flash[:error] %>
<% end %>
<% if flash[:warning] %>
   <%= flash[:warning] %>
<% end %>
<% if flash[:notice] %>
   <%= flash[:notice] %>
<% end %>


To
<%= show_flash(flash) %>


I hope it will help u..

Thank you


On Mon, Mar 23, 2009 at 7:31 PM, Fresh Mix  wrote:

>
> How can I replace this with helper?
>
> <% if flash[:error] %>
><%= flash[:error] %>
> <% end %>
> <% if flash[:warning] %>
><%= flash[:warning] %>
> <% end %>
> <% if flash[:notice] %>
><%= flash[:notice] %>
> <% end %>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
Wu You Duan

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



[Rails] Re: GoogleMaps book and FCC ASR Database

2009-03-23 Thread Agustin Nicolas Viñao Laseras
I can access with a proxy, thanks.



On Mon, Mar 23, 2009 at 3:38 AM, Chris Kottom wrote:

> http://wireless.fcc.gov/uls/data/complete/r_tower.zip seems to work for
> me.  Maybe blocked from your location?
>
>
> On Sun, Mar 22, 2009 at 2:22 PM, Agustin Viñao <
> rails-mailing-l...@andreas-s.net> wrote:
>
>>
>> Hi, im reading the book GoogleMaps app with Rails and ajax, in the
>> chapter 5, i need to download the FCC ASR Database
>> (http://wireless.fcc.gov/uls/data/complete/r_tower.zip) but the link is
>> broken.
>>
>> Do you know where im donwload this file?
>>
>> Google don't give me any valid location.-
>>
>> PD. sorry my english.
>> Thanks
>> --
>> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Ajax not defined.

2009-03-23 Thread Intern ruby

This is my code and I am trying to call remote function when somebody
click on add button after selecting something from select_tag. Please
tell me where I am wrong ? I am getting following error: Ajax not
defined.




<%= select_tag 'available_line_id[]',options_for_select(customers),{:id
=> 'available_line_id',:multiple => true, :size => 13, :style => 'width:
225px;'} %>



Thanks,

Attachments:
http://www.ruby-forum.com/attachment/3475/new.html.erb

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



[Rails] Where is the sqlite .db file?

2009-03-23 Thread Vince Gilbert

Hi all,

I've been reading a ton, doing tutorial, and generally trying to learn
Ruby on Rails.

I have a question that I haven't been able to find the answer to.

Where is the .db file that sqlite3 creates for Rails projects?  I can't
for the life of me figure out how to access the database tables.  I even
downloaded a few sqlite GUI tools, but when they ask me which db file
I'd like to open, I can't find one anywhere.  I even did a full search
on my c: for *.db*

Thanks for your help,

Vince
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Just how the hell do you set Cache-Control max-age?

2009-03-23 Thread Petr Janda

Hi all,

Ive been googling for couple of hours and I just cant figure it out. I
want to set the max-age value to 300 for the WHOLE application,
regardless of development or production mode.

Is there anyone that knows?

Petr
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Helper

2009-03-23 Thread Fresh Mix

How can I replace this with helper?

<% if flash[:error] %>
<%= flash[:error] %>
<% end %>
<% if flash[:warning] %>
<%= flash[:warning] %>
<% end %>
<% if flash[:notice] %>
<%= flash[:notice] %>
<% end %>
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: About membership of this group

2009-03-23 Thread MaD

welcome, you are here. just ask.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] About membership of this group

2009-03-23 Thread pankaj88

Hi to every one i m new to ruby on rails. I want to join this group
for get my question regarding RoR  answered.

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



[Rails] Re: PDFs prawn gem freeze into the app...

2009-03-23 Thread bingo bob

ok, thanks, I'll try that a bit later and report back.

bb
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: to_param vs to_query

2009-03-23 Thread Miguel Regedor

I noticed a funny thing, while doing this. We can not use it with an
Hash inside an array because the Hash elements will be spread all over
the array thanks to URL query brackets syntax for Arrays(if the array
index was specified in this syntax it would work, but I don't think
there is way to get to_query doing it I think the best way is to use
only Hashes instead).
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] export to pdf, txt and the utf8-problem.

2009-03-23 Thread Rudy

Hi,
can't seem to figure it out. I have text saved as UTF8 in my MySQL
database, and it shows up fine in the browser. However, I want to
export to pdf (pdf;writer) and csv-text. When I do that the accented
foreign characters do not show up.

I've tried to convert them before exporting, but I don't seem to be
able to get it right. (Iconv etc. do not seem to convert it.) I've
also looked it up on the forum, but I can't find the right solution.
Any suggestion is greatly appreciated.
Rudy
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] In_place_edit_for in models

2009-03-23 Thread Swarna Priya

Hi all,

 I am new to RoR. At present I am working with Ajax. I have
doubt in place_editing.

  Kindly please help me in this regard. I am struggling with
this for past one week.

   Any help from your side will be very helpful.

 I have a model called child_users. I am listing all the children for
the logged in User using  tags.

The code is as follows app/controllers/child_user_controller.rb

class ChildUserController < ApplicationController


  in_place_edit_for :child_user, :name


  def show_all
@parent_user = User.find(SessionController.user)
if @parent_user
  @child_users = @parent_user.child_users
else
  redirect_to(:controller => "session", :action => "sign_out")
end
  end

end


and the view code is app/views/child_user/show_all.html.erb


Your Kids


<% @child_users.each do |child| %>


  

 <%= child.name -%> 
<%= in_place_editor "child_user_name", :url => {:controller =>
:child_user, :action => 'set_child_user_name', :id => child} %>

 <%= link_to_remote 'Edit', :url => { :action => "edit",
:id => child.id }, :update => "edit" %>
<%= link_to_remote 'Delete User', :url => { :action =>
"confirm_ajax", :id => child.id }, :update => "confirm" %>
 <%= child.filter_level.description %> 
   hi



<% end %>



As shown above, I tried to implement my own ajax based Edit. But the div
is displayed only in the first child. When edit link is clicked in the
second child, the div again opens only in the first child's div and not
in the corresponding child.

 Hence i tried using in_place_edit but the same problem happens. Only
the first child is editable. If clicked, it displays around 5 text
boxes(i.e. number of children for the user). The next child doesnt have
the click option at all.


What mistake am i doing. Can anyone help me please.

I ma struggling with this a lot. Thanks for all help.


Regards,
Swarna
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Setting Session Options in Rails 2.3

2009-03-23 Thread hawkerb

I am having exactly the same problem. However, for me, old:

class ImagesController < ApplicationController
  session :cookie_only => false
end

does *not* work anymore. TomRossi7, can you double check does it work
for you, please?

The only way I worked this around, is to get sessions directly from
SessionStore, which is extremely bad. Also I can't find tests
regarding cookie_only option in 2.3.



On Mar 23, 1:44 am, TomRossi7  wrote:
> I'm trying to figure out how I should set my session options for Rails
> 2.3.  In Rails 2.2:
>
>   session :cookie_only => false, :only => :swf_upload
>
> In Rails 2.3, it looks like I need to use:
>
>   request.session_options['cookie_only'] = false
>
> But how do I tell it that I only want that option on a specific method
> in the controller (the :only option)?
>
> Thanks!
> Tom
>
> p.s.  The old way works, but the deprecation warnings are driving me
> nuts when I run my tests.

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



[Rails] Re: PDFs prawn gem freeze into the app...

2009-03-23 Thread ruby...@ymail.com



On 23 Mar., 10:01, bingo bob  wrote:
> I was having great success with creating PDFs with prawn, I followed
> Ryan Bates latest screencast. All good.
>
> Trouble is when i come to deploy the app on my webhost I ran into
> trouble.
>
> Rails 2.3 app.
> I did, "sudo rake gem unpack prawn" to freeze it in.
>
> I put the app on my webhost but it won't start, some error saying it
> can't find prawn.
>
> Any ideas? (summary: works locally not on my webhost)

On your local machine:

´rake gems:unpack GEM=prawn´

Then deploy afterwards.

--
Best regards,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] PDFs prawn gem freeze into the app...

2009-03-23 Thread bingo bob


I was having great success with creating PDFs with prawn, I followed
Ryan Bates latest screencast. All good.

Trouble is when i come to deploy the app on my webhost I ran into
trouble.

Rails 2.3 app.
I did, "sudo rake gem unpack prawn" to freeze it in.

I put the app on my webhost but it won't start, some error saying it
can't find prawn.

Any ideas? (summary: works locally not on my webhost)
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: When are activerecord associations made?

2009-03-23 Thread Sijo Kg

Write as

library = Library.new(params)
book = library.books.build(params)
library.save

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



[Rails] URL-encoding and decoding on Rails

2009-03-23 Thread Evan

I have a URL parameter that has special characters on it, so I do URL
encoding as such:

my_url(:email => CGI.escape("someemail+extens...@mail.com")

Now, I would expect to call a CGI.unescape(params[:email]) on the
action receiving this parameter, and this is true according to my
functional tests.

But when I tested this on the browser, it failed because, apparently,
I didn't need to do any URL-decoding, and when I did it gave me
"someemail+extension mail.com".

Is there a built-in URL-decoding on the controller side? If so, how is
it that it doesn't work on my functional tests.

I tested this on Safari and Firefox 3 browser, by the way.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---