[Rails] SQLite - show html from entry

2010-06-18 Thread Eric Yen
Hi,

I have an entry in my database that has line breaks.
I want those line breaks to actually appear as line breaks when the
entry is displayed.

So, I did something like:

<%= string_var.sub("\n","":) %>

It partially works. It actually replaces the < with < and the >
symbol with >.
Is there a work around this?

Thank you,
Eric

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



[Rails] Re: rake db:create uninitialized constant Mysql::Error

2010-06-01 Thread Eric Platon
Michael^2,

I have faced the same problem, and here is how I solved it, with the
list of failures. Note that I have faced the problem only once on this
particular configuration. Elsewhere (PPC and x86_64) the world is
cloudless.

Configuration:
- OS: Fedora 12
- Arch: PPC64
- Rails 3 pre
- Gem 1.3.6
- Ruby 1.8.8 (I use 1.8.7 on my other machines, but I needed some
extra patches to compile against openssl 1.0---yet another story :-P )

(Fail 1) Installed the gem with Bundler
(Fail 2) Installed the gem with gem, and bundle it with Bundler
(Fail 3) Installed the library manually

Given that my repository assumes we use Bundler, I then did again
(Fail 1). This is the configuration that will work in the following...

At this point, I started to go along the new Rails bootstrap process.
Playing also with IRB (`rails c`) and Rake, I realized that the gems
are all loaded but mysql. The most interesting:

$ rake db:setup --trace   #=> Fail
$ rake -r mysql db:setup --trace  #=> Success, although all Mysql
constants are flagged as already initialized...

Which confirms a weird behavior with the load process for the mysql
gem, on that particular architecture.

In the Gemfile, I have then bypassed Gem to load the mysql library
directly:

# Database
#gem 'mysql'
require 'mysql'

Doing so everything works fine now. I would like to understand what is
happening but I am a bit short in time now :-( Note that this
modification of the Gemfile is not what we want on all machines. Given
that this PPC64 machine is my production server, a simple conditional
to choose between gem or require may be sufficient, waiting for a
proper fix.

I hope this can help you, but I have a rare architecture these days...
Not sure it is applicable directly.

Eric


On Apr 12, 3:04 pm, Michael Michael  wrote:
> John Grimes wrote:
> > Post up the output of this command:
> > gem list
>
> *** LOCAL GEMS ***
>
> abstract (1.0.0)
> actionmailer (3.0.0.beta2, 2.3.5, 2.2.2, 1.3.6)
> actionpack (3.0.0.beta2, 2.3.5, 2.2.2, 1.13.6)
> actionwebservice (1.2.6)
> activemodel (3.0.0.beta2)
> activerecord (3.0.0.beta2, 2.3.5, 2.2.2, 1.15.6)
> activeresource (3.0.0.beta2, 2.3.5, 2.2.2)
> activesupport (3.0.0.beta2, 2.3.5, 2.2.2, 1.4.4)
> acts_as_ferret (0.4.4, 0.4.3)
> arel (0.3.3)
> builder (2.1.2)
> bundler (0.9.18)
> capistrano (2.5.18, 2.5.2)
> cgi_multipart_eof_fix (2.5.0)
> daemons (1.0.10)
> dnssd (0.6.0)
> erubis (2.6.5)
> fastthread (1.0.1)
> fcgi (0.8.7)
> ferret (0.11.6)
> gem_plugin (0.2.3)
> highline (1.5.2, 1.5.0)
> hpricot (0.6.164)
> i18n (0.3.6)
> libxml-ruby (1.1.2)
> mail (2.2.0, 2.1.5.3)
> memcache-client (1.8.2)
> mime-types (1.16)
> mongrel (1.1.5)
> mysql (2.8.1)
> needle (1.3.0)
> net-scp (1.0.2, 1.0.1)
> net-sftp (2.0.4, 2.0.1, 1.1.1)
> net-ssh (2.0.21, 2.0.4, 1.1.4)
> net-ssh-gateway (1.0.1, 1.0.0)
> polyglot (0.3.1)
> rack (1.1.0, 1.0.1)
> rack-mount (0.6.1)
> rack-test (0.5.3)
> rails (3.0.0.beta2, 2.3.5, 2.2.2, 1.2.6)
> railties (3.0.0.beta2)
> rake (0.8.7, 0.8.3)
> RedCloth (4.1.1)
> ruby-openid (2.1.7, 2.1.2)
> ruby-yadis (0.3.4)
> rubygems-update (1.3.6)
> rubynode (0.1.5)
> sqlite3-ruby (1.2.4)
> termios (0.9.4)
> text-format (1.0.0)
> text-hyphen (1.0.0)
> thor (0.13.4)
> treetop (1.4.5)
> tzinfo (0.3.19)
> xmpp4r (0.5, 0.4)
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] CAS Authentication

2010-05-06 Thread Eric B.
So I have recently tried authenticating to a cas server for a project,
and every time I try to access my cas server it returns

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B:
certificate verify failed

Now I am using the CAS gem found here
http://rubycas-client.rubyforge.org/

I know the certificate on the CAS server is valid and correct, and i am
new to RoR
any help?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Re: id upper bounds

2010-04-19 Thread Eric B.
To all that have helped out thank you I do have what i wanted to 
accomplished though it may not be super efficient it does what i need 
with no repeats from my tests here is what i have done.


index.html.erb

<% @contents.each do |content| %>
<%=h(truncate(content.cont_url , 20)) %>
<%=h content.comments %>

<% end %>




content_controller.rb

def index
@contents = Content.find_content

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


content.rb

def self.find_content
 find(:all, :limit => '3', :order => 'rand()')
end



If you have any questions or improvements or comments please let me know 
thank you..
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: id upper bounds

2010-04-19 Thread Eric B.
Franz Strebel wrote:

> last_id = MyModel.find(:first, :order => 'id desc').id

@Franz

Thanks this worked great well kinda, I'm confused on why there is the 
'.id' at the end also how would I limit this to give me say the first 3 
from the back of the list instead of

:all or :first and :limit => 3

 didn't work because i am calling this in my 'MyModel.rb' file so in my 
index.html.erb file its set for .each with a do loop and every other 
thing i have tried has bombed

People may say RoR is fun and easy and at the beginning it is but 
sometimes its really frustrating
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] id upper bounds

2010-04-18 Thread Eric B.
I am new to both ruby and rails and a recent project I am trying has got
me working on it. I am trying to find a nice easy lightweight way to
find the last 'id' in a mysql database so I can take it and use it as
the upper bound in a random number generator.

My problem is that I haven't found an easy way to do this, but my only
other idea is to do something like a do loop that puts the ids into an
array and then grab the upper bound from that and that seems like a bad
idea.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Can't Convert Symbol into Integer

2010-04-10 Thread Eric Powell
Frederick Cheung wrote:
> On Apr 10, 3:25�pm, Eric Powell  wrote:
>> I must have really screwed something up big time. �I was trying to
>> modify SortHelper to work on multiple columns and now I can't get
>> anything to work even though I reverted all my changes.
>>
> 
> Looks like at some point you stored something in sessi...@sort_name]
> that was an array - although you may have reverted the code that
> caused that to happen your old session is still there.
> 
> Fred

Thanks, Fred.  You were spot on.  I just added sessi...@sort_name] = nil 
to sort_init, ran the code, then commented it out and I was all set.


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

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



[Rails] Can't Convert Symbol into Integer

2010-04-10 Thread Eric Powell
I must have really screwed something up big time.  I was trying to
modify SortHelper to work on multiple columns and now I can't get
anything to work even though I reverted all my changes.

I keep getting the error:
can't convert Symbol into Integer
C:/Users/Eric
Powell/Documents/ruby/my1fnc/app/helpers/sort_helper.rb:108:in `[]'
C:/Users/Eric
Powell/Documents/ruby/my1fnc/app/helpers/sort_helper.rb:108:in
`sort_clause'
C:/Users/Eric
Powell/Documents/ruby/my1fnc/app/controllers/posts_controller.rb:29:in
`index'

The offending line in sort_helper.rb is:
result = sessi...@sort_name][:key] + ' ' +
sessi...@sort_name][:order]

Here's my entire SortHelper module:

module SortHelper

  require 'active_support/inflector'

  # Initializes the default sort column (default_key) with the following
  # options:
  #
  # - :default_order -- the default sort order 'asc' or 'desc'. Defaults
to
  #   'asc'.
  # - :name -- the name of the session hash entry that stores the sort
state.
  #   Defaults to '_sort'.
  # - :icons_dir -- directory with sort direction icons. Defaults to
  #   /images
  #
  def sort_init(default_key, options={})
options = { :default_order => 'asc',
:name => params[:controller] + '_sort',
:icons_dir => '/images',
  }.merge(options)
@sort_name = options[:name]
@sort_default = {:key => default_key, :order =>
options[:default_order]}
@icons_dir = options[:icons_dir]
  end

  # Updates the sort state. Call this in the controller prior to calling
  # sort_clause.
  #
  def sort_update()
if params[:sort_key]
  sort = {:key => params[:sort_key], :order => params[:sort_order]}
elsif sessi...@sort_name]
  sort = sessi...@sort_name]   # Previous sort.
else
  sort = @sort_default
end
sessi...@sort_name] = sort
  end

  # Returns an SQL sort clause corresponding to the current sort state.
  # Use this to sort the controller's table items collection.
  #
  def sort_clause()
result = sessi...@sort_name][:key] + ' ' +
sessi...@sort_name][:order]
result if result =~ /^[\w_]+ (asc|desc)$/i  # Validate sort.
  end

  # Returns a link which sorts by the named column.
  #
  # - column is the name of an attribute in the sorted record
collection.
  # - The optional text explicitly specifies the displayed link text.
  # - A sort icon image is positioned to the right of the sort link.
  #
  def sort_link(column, text=nil, options=nil)
key, order = sessi...@sort_name][:key], sessi...@sort_name][:order]
if key == column
  if order.downcase == 'asc'
icon, order = 'sort_asc.png', 'desc'
  else
icon, order = 'sort_desc.png', 'asc'
  end
else
  icon, order = nil, 'asc'
end
text = ActiveSupport::Inflector::titleize(column) unless text
params = {:params => {:sort_key => column, :sort_order => order } }
params = params.merge(options[:params]) if options[:params]
link_to(text, params) +
  (icon ? nbsp(2) + image_tag(File.join(@icons_dir,icon)) : '')
  end

  def sort_header_tag(column, options = {})
text = options.delete(:text) ||
ActiveSupport::Inflector::titleize(column.humanize)
options[:title]= "Sort by #{text}" unless options[:title]
text = options[:title] || options.delete(:text) ||
ActiveSupport::Inflector::titleize(column.humanize)
content_tag('th', sort_link(column, text, options), options)
  end

  private

# Return n non-breaking spaces.
def nbsp(n)
  ' ' * n
end

end

and here's the relevent code from my controller:
  def index

  sort_init 'name'
  sort_update

  if not params[:q].blank?
options = { :conditions => params[:q] }
  end

  options = { :order => sort_clause }

  @clause = options[:order]
  #...@posts = Post.all
#  @posts = Post.find(:all, :order => sort_clause)
  @posts = Post.find(:all, options)

  respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml => @posts }
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: rerender a page if validation fails

2010-03-17 Thread Eric Artzt
Your error case rendered the edit template... pretty standard.

The path was called on a POST (the update). There is no corresponding
GET version of that path. So when you try to go there in the browser
you get an error.

On Mar 17, 10:34 pm, Tom Mac  wrote:
> Hi
>    I have in routes.rb like
> map.resources :users
>
>         Now I am trying to edit a user. What the url shows now 
> ishttp://localhost:3000/users/1/edit
>       But my problem is , when I click on update button and if
> validations fail I am re rendering the edit page.  And it happens
> properly. But the url becomes
>
> http://localhost:3000/users/1
>
>            I can't figure it out . Please give a solution. Why this
> happens? So if a user goes to url and press enter it will show
>
> Unknown action
>
> No action responded to show. Actions: create, edit, new, and update
>
>     My controller code for update is
>
>   def update
>     �...@user = User.find(params[:id])
>       respond_to do |format|
>   if @user.update_attributes(params[:user])
>           flash[:notice] = 'User was successfully updated.'
>           format.html { redirect_to home_url }
>           format.xml  { head :ok }
>         else
>           flash.now[:error] = @user.errors.full_messages.join("")
>           format.html { render :action => "edit" }
>           format.xml  { render :xml => @user.errors, :status =>
> :unprocessable_entity }
>         end
>       end
>   end
>
> Thanks in advance
> Tom
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: One-time script to update 1000s of values in a single column in a table: nil error?

2010-03-17 Thread Eric Artzt
it looks like you are trying to strip a leading space from each
"strength" value if its not nil.

something like

stocks = Stock.find(:all, :conditions => '(strength IS NOT NULL) AND
(strength != "")')

would give you all the stocks values with non-blank values. So you can
skip a lot of your testing above.

You could then do something like

stocks.each do |stock|
   stock.strength = stock.strength.to_s.gsub(/^\s+/,'')
   stock.save
end

the above is using a regular expression to match the leading spaces.
the to_s shouldn't be necessary, because you should only be dealing
with non-nil strength values at this point, but it's defensive coding.

rails has a string extension .blank? which returns true for empty or
nil or spaces values, e.g.

nil.blank?
[].blank?
"   ".blank?
''.blank?

all return true


On Mar 17, 7:26 pm, "Clay H."  wrote:
> Hi, I have a model called Stock with a value called "strength." I
> wrote a simple method in the Stock.rb model file to update the value
> of "strength" for each record in the stocks table. I created a
> controller called fix_controller.rb. I don't have access to the live
> system, so the idea is that an admin will go tohttp://url/fixand a
> script will run to check and potentially update the "strength" value
> for every record in the stocks table.
>
> fix_controller.rb
> ^^^
> class FixController < ApplicationController
>
>   def index
>     stocks = Stock.find(:all)
>
>     stocks.each do |s|
>         if s.strength.nil? || s.strength == ''
>           puts 'nothing to update'
>         else
>           s.update_units
>         end
>     end
>   end
> end
>
> Stock.rb
> ^
> def update_units
>     if self.strength == '' || self.strength.nil?
>    puts 'nil - cannot update'
> elsif self.strength != '' && self.strength != nil
>  self.strength = self.strength.gsub!(' ml', 'ml') if
> self.strength.gsub!(' ml', 'ml') != nil
>  self.strength = self.strength.gsub!(' mL', 'ml') if
> self.strength.gsub!(' mL', 'ml') != nil
>  self.strength = self.strength.gsub!(' g', 'g') if self.strength.gsub!
> (' g', 'g') != nil
>  self.strength = self.strength.gsub!(' oz', 'oz') if
> self.strength.gsub!(' oz', 'oz') != nil
>  self.strength = self.strength.gsub!(' mg', 'mg') if
> self.strength.gsub!(' mg', 'mg') != nil
> end
>
> When I try to run this, I always get the error:
>
> NoMethodError: private method `gsub' called for nil:NilClass
>
> I'm sure this is a simple error and/or I'm not going about this the
> correct way. I really only need to run this code once... Any idea why
> I'm getting that error? I'm checking for nil...

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



Re: [Rails] mysql on mongrel vs apache

2010-03-13 Thread Eric Bolden
It looks like you are running out of memory (RAM) and disk-swapping is 
accounting for the difference in times.


On Mar 13, 2010, at 3:43 AM, Ease Bus wrote:

> 
> Thanks all.  The amount of data on the Ubuntu staging server is a little bit 
> more than the data on my Leopard laptop.  So the slight difference in DB 
> access time seems reasonable.  What worries me is the intolerably long time 
> the Ubuntu machine takes to produce the views.  I also notice that the 
> ruby1.8 process on Ubuntu briefly shots up close 100% of the CPU during that 
> time.  Below are the specs of the computers
> 
> Snow Leopard Laptop :  MacBook Pro 2.53 GHz Intel Core 2 Duo, 4GB 1067 MHz 
> DDR3, 250.06 GB SATA hard drive
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
> Rails 2.3.5
> mysql  Ver 14.14 Distrib 5.1.43, for apple-darwin10.2.0 (i386) using readline 
> 5.1
> Mongrel
> 
> Ubuntu 9.10 Server (old former custom built Windows xp computer):  Intel 
> Pentium 4 3.00 Ghz, 1G RAM, 18 (eighteen) GB hard drive. (IDE), 855 MB is 
> swap partition.
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
> Rails 2.3.5
> mysql  Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (i486) using  EditLine 
> wrapper
> apache2
> Could the difference in hardware configuration explain the slowness in the 
> Ubuntu box?  
> 
> >> On my Leopard, I get: Completed in 643ms (DB: 322) | 302 Found
> >> For Ubuntu, I get: Completed in 8803ms (DB: 517) | 302 Found

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



[Rails] Re: Weird install problems

2010-03-06 Thread Eric B.
Eric B. wrote:
> I am new to RoR, and I am just starting out, but I am having massive
> problems doing what should be a painless install. I am running a windows
> machine and I have ruby installed as well as gems.
> 
> When I try to do the command
> gem install rails
> I get
> 
> c:\Ruby19>gem install rails
> ERROR:  While executing gem ... (Errno::ENOENT)
> No such file or directory - P:/
> 
> I do not want it to install to a P:/ directory and I have no clue how to
> change its install path.
> 
> I have reinstalled both ruby and gems multiple times
> and I would greatly appreciate any advice you have for me.

I have solved my problem. for those of you who want to know what the 
problem is that the HOMEDRIVE was set to P:
to fix this if you type "set HOMEDRIVE=C:" in command prompt and then 
verify with an "echo HOMEDRIVE" and then run the install it should work.

Thanks if you were working on this.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Weird install problems

2010-03-06 Thread Eric B.
I am new to RoR, and I am just starting out, but I am having massive
problems doing what should be a painless install. I am running a windows
machine and I have ruby installed as well as gems.

When I try to do the command
gem install rails
I get

c:\Ruby19>gem install rails
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - P:/

I do not want it to install to a P:/ directory and I have no clue how to
change its install path.

I have reinstalled both ruby and gems multiple times
and I would greatly appreciate any advice you have for me.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: reCAPTCHA headache

2010-02-07 Thread Eric J. Gruber
That doesn't look bad, but I'd love to find something that doesn't use
RMagick.

On Feb 7, 10:26 pm, Sean Six  wrote:
> You may want to try this one as an alternative:
>
> http://expressica.com/simple_captcha/
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: reCAPTCHA headache

2010-02-07 Thread Eric J Gruber
Hi Sean, thanks for writing.

The only error I get is that the words typed were incorrect and that I
need to try again. But the words are correct; it's not accepting the
words that are typed.

Eric

On Feb 7, 10:08 pm, Sean Six  wrote:
> Is it throwing some kind of rails error or is the reCAPTCHA not
> accepting a correct answer?
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] reCAPTCHA headache

2010-02-07 Thread Eric J Gruber
I'm trying to use this (http://ambethia.com/recaptcha/) reCAPTCHA
plugin and have almost got it working. Help me get the last part? I
can't seem to find anything in the logs that indicate an error.

Here is my code. Everything is working good except that part where the
code that's typed is actually validated. Instead, it keeps kicking
back an error. Everything appears to be installed correctly, since the
reCAPTCHA box is showing up; it's just not letting my form save even
though the words are typed correctly.

new.html.erb:
...
<%= recaptcha_tags %>
  
  <%= f.submit 'Submit Your Job' %>
<% end %>

jobs_controller.rb:
def create
@job = Job.new(params[:job])

respond_to do |format|
if verify_recaptcha
  @job.save
flash[:notice] = 'You job listing was successfully created.'
format.html { redirect_to(@job) }
format.xml  { render :xml => @job, :status
=> :created, :location => @job }
  else
flash[:notice] = 'There was an error with the reCAPTCHA,
please
try again.'
format.html { render :action => "new" }
format.xml  { render :xml => @job.errors, :status
=> :unprocessable_entity }
  end
end
  end

Thanx in advance,

Eric

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



[Rails] Re: Struggling to delete posts... Can you help?

2009-12-05 Thread Eric
Without seeing your view, I'll guess that you're using "for foo in
@foo do" ...if you use "@foo.each do |foo|" it should work,
since .each doesn't return an error on nil like 'for' does.

-eric

On Dec 5, 9:00 am, RubyonRails_newbie 
wrote:
> Cool - thank you for that. It makes sense to me now.
>
> What I now have is this:
>
>                    <%= image_tag ("delete.png") %>
>         <%= link_to "Delete post?",
>                         { :controller => "posts", :action => "delete",
>                           :id => @posts.id },
>                           :confirm => "Really delete?" %> |
>
> This successfully deletes the posts, one at a time until they have all
> gone. However, once the last post of that user has been deleted, I get
> an error:
>
> Called id for nil, which would mistakenly be 4 -- if you really wanted
> the id of nil, use object_id
>
> I know this is because it cannot find any posts for that post.id, but
> is there a good if else statement i can add to it to render the
> profile page once all have been erased?
>
> I've looked over it, but am a bit lost..
>
> THanks again
>
> On 5 Dec, 16:00, phil  wrote:
>
> > Sorry forgot to say that in the view that line is inside an iterator:
>
> > <% for post in @posts %>
> > <%= link_to image_tag("cross.png"), post, :confirm => 'Are you
> > sure?', :method => :delete, :title => "Delete this post" %>
> > <% end %>
>
> > where @posts is set by:
> > @posts = Post.all
> > in the PostsController#index method.
>
> > On Dec 5, 4:58 pm, phil  wrote:
>
> > > I don't see where you are actually passing in the id!
>
> > > We do something like this:
>
> > > <%= link_to image_tag("cross.png"), post, :confirm => 'Are you
> > > sure?', :method => :delete, :title => "Delete this post" %>
>
> > > That gives us an icon to click on and will delete the post by calling
> > > PostsController#destroy
>
> > > which looks like:
>
> > >   def destroy
> > >     @post = Post.find(params[:id])
> > >     @post.destroy
>
> > >     respond_to do |format|
> > >       format.html { redirect_to(posts_url) }
> > >       format.xml  { head :ok }
> > >     end
> > >   end
>
> > > On Dec 5, 4:40 pm, RubyonRails_newbie 
> > > wrote:
>
> > > > Hello there,
>
> > > > I am looking to be able to delete posts from within my account page.
>
> > > > I have a destroy action within the posts controller, which looks like
> > > > this:
>
> > > >   def destroy
> > > >     @post = Post.find(params[:user_id])
> > > >     @post.destroy
>
> > > >     respond_to do |format|
> > > >       format.html { redirect_to :controller => "profile"}
> > > >       format.xml  { head :ok }
> > > >     end
> > > >   end
>
> > > > And I also have the button which is clicked to delete a post.
>
> > > >         <% form_tag(:controller => "posts", :action => "destroy", 
> > > > :confirm =>
> > > > 'Are you sure?') do %>
> > > >           <%= submit_tag("Delete") %>
>
> > > > However - when i click 'delete' I get the following error:
>
> > > > ActiveRecord::RecordNotFound in PostsController#destroy
>
> > > > Couldn't find Post without an ID
>
> > > > I changed '@post = Post.find(params[:user_id])' to only have :id as a
> > > > param, but that returned with the same issue.
>
> > > > Can anyone help?
>
> > > > Many Thanks

--

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




[Rails] Online Auction

2009-12-01 Thread Eric
I'm looking for a script or engine that can be customized.  We are
building an site that has a specialized auction as part of it's
functions.

Somethings that will be different from a regular Dutch auction are
-multiple bidders will be accepted (grouped to complete the bid) as
they will be bidding on lending and borrowing
-Auctioneer will have the right to accept or reject bids
-Auctioneer will be able to set the duration of the auction and can
close it at anytime
-Both parties can negotiate counter offers/bids
-Auction will automatically end when the total requested bid is meet

These are not features we need to be include (though any would be
nice) rather we would like to start with a base environment that can
be modified

Thanks

--

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




[Rails] Re: Heroku.... I'm sceptical

2009-11-25 Thread Eric
You're paying for an account? From their support page (linked on the
top right of heroku.com):

"If you're experiencing a problem with your app, the best way to
ensure a timely response is to submit a ticket. Using the ticket
system will allow you to communicate directly with our support staff,
and receive email updates as soon as there's activity on your
request."

-eric

On Nov 25, 12:53 pm, "rails.n...@gmail.com" 
wrote:
> About *your* account that *you* pay for.
>
> As for proof... well I'm just saying I got my messages filtered out.
>
> This group is highly active with relatively low spam, imo.
>
> On Nov 26, 2:14 am, Thufir  wrote:
>
> > Heroku uses a mailing list, which *they* administrate -- privately.
> > If you have a problem with them you can always contact *their* list
> > administrator.
>
> >http://groups.google.com/group/heroku/abouthttp://www.gmane.org/info
>
> > -Thufir

--

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




[Rails] Re: Alert: Check your Emails are being sent

2009-11-22 Thread Eric
Does setting:

ActionMailer::Base.raise_delivery_errors = true

in your environment help?

-eric

On Nov 22, 10:59 am, icke  wrote:
> I have just noticed that my emails have stopped being generated by
> actionmailer Net::SMTPFatalError (553 Invalid mail address)
>
> This is a known problem and is really hard to track down.  
> Seehttps://rails.lighthouseapp.com/projects/8994/tickets/2340-action-mai...
>
> Some others are getting slightly different messages but it all
> revolves around the name format
>
> It affects 2.3.3 and 2.3.4 and also an issue on ruby 1.8.7 and 1.9.1.
> It is scheduled to be fixed in 2.3.5
>
> There is a workaround.
>
> I hope posting this here will help someone else google this error.  I
> couldn't find anything on the group archive.
>
> O.

--

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




[Rails] Re: Creating a new Y object from X's controller

2009-11-21 Thread Eric
Y.new

controllers don't care what models you use.

-eric

On Nov 21, 12:09 pm, RVince  wrote:
> If I am in the controller for Model X, and inside a method there I
> want to create a new instance of (i.e. insert a new row into the DB
> table for) Model Y, how do I express this? Thanks, R.Vince

--

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




[Rails] Re: How can a rails app get its host name?

2009-11-21 Thread Eric
An example that has caused me to have to use a config.yml,
ActionMailer will not have request.* available. System calls would not
work in this case either, since they would return a bad value on
vhosts or in cases where the hostname is different than request.host.

-eric

On Nov 19, 11:57 am, Frederick Cheung 
wrote:
> On Nov 19, 7:55 pm, explainer  wrote:
>
> > I would like my Rails app to supply a callback url to another app.  I
> > currently have a yaml file in the config folder in which I put the
> > host name, but I would like to be able to query that dynamically and
> > do away with the yaml file.  Is there a method call that returns the
> > current host?
>
> Sort of - a given request has a host name (look at the methods on
> ActionController::Request), obviously you can only get at that inside
> a controller action.
>
> Fred

--

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




[Rails] Re: security issue: deployment user => :yes or :no?

2009-11-18 Thread Eric
among other reasons, so you can look at the logs and be able to
differentiate between connections from "deploy" and connections from
"christoph."

why aren't you sure you should use a separate account?

-eric

On Nov 18, 11:48 am, Christoph Jasinski
 wrote:
> Hi everybody,
>
> I run Linux on my server and am thinking of diving into capistrano for
> deployment. However I'm not sure whether I should follow the advice of
> having a special user for deployment (say deploy). Maybe somebody could give
> me some advice from their experience. What and where are the risks of not
> don't it the described way. How and to what shall I restrict that particular
> user to avoid unnecessary hacks?
>
> I already got a user and a group for the git repositories. (the git user is
> bound to the git-shell)
>
> Thanks in advance.
>
> Chris

--

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




[Rails] Re: Propogating the current view's id to a child object

2009-11-17 Thread Eric
Check your params for the correct property id parameter.

-eric

On Nov 17, 4:33 pm, "Todd A. Jacobs"  wrote:
> On Tue, Nov 17, 2009 at 04:16:46PM -0800, Eric wrote:
> > routes.rb:
> > map.resources :properties, :has_many => :notes
> > <%= link_to 'New note', new_property_note_path(@property) %>
>
> I did that, and it works for views (e.g. "/properties/4/notes/2"). However, I
> get this error when I try to actually create a note:
>
>     ActiveRecord::RecordNotFound in NotesController#create
>     Couldn't find Property without an ID
>
> In my notes_controller.rb, I have:
>
>   def new
>     @note = Note.new
>     respond_to do |format|
>       format.html
>     end
>   end
>
>   def create
>     @note = Property.find(params[:id]).notes.create(params[:note])
>     @note.user_id = current_user.id
>
>     respond_to do |format|
>       if @note.save
>         flash[:notice] = 'Note was successfully created.'
>         format.html { redirect_to property_path @note.property_id }
>       else
>         format.html { render :action => "new" }
>       end
>     end
>   end
>
> So, something is still not quite right. How is @note supposed to get the
> property id from params here?
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"

--

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




[Rails] Re: Propogating the current view's id to a child object

2009-11-17 Thread Eric
routes.rb:

map.resources :properties, :has_many => :notes

view:

<%= link_to 'New note', new_property_note_path(@property) %>

or however you're holding the property in the view, if not
@property...

'rake routes' for more

-eric

On Nov 17, 2:23 pm, "Todd A. Jacobs"  wrote:
> On Tue, Nov 17, 2009 at 01:40:25PM -0800, Eric wrote:
> > notes_controller:
> > def create @note =
> > Property.find(params[:id]).notes.create(params[:note]) ... end
>
> I'm not sure I'm following this. If I follow a link from a property
> view:
>
>     <%= link_to 'New note', new_note_path %>
>
> how is Property.find(params[:id]).notes.create(params[:note]) going to
> find @Property? I don't really understand how that's getting passed
> along via params here.
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"

--

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




[Rails] Re: Propogating the current view's id to a child object

2009-11-17 Thread Eric
Assuming your associations are kosher and notes are never created
without a parent property, I'd rely on Rails Magic(tm) do the note
create via the Property model and leave the session alone altogether:

notes_controller:

def create
  @note = Property.find(params[:id]).notes.create(params[:note])
  ...
end

Once you're back in the view, you can still get the property via the
reflexive association in @note via @note.property

-eric

On Nov 17, 12:30 pm, "Todd A. Jacobs"  wrote:
> I have a problem with the way I'm currently propagating the object id
> from the current view to child objects. Right now, I'm doing this:
>
>     # properties_controller.rb
>     def show
>         @property = Property.find(params[:id])
>         session[:property] = params[:id]
>         # snipped for brevity
>     end
>
>     # notes_controller.rb
>     def create
>         @note = Note.new(params[:note])
>         @note.property_id = session[:property]
>         # snipped for brevity
>     end
>
> This populates the foreign key in the note with the parent object's id.
>
> This works so far as it goes, but there's a problem here. Basically, if
> more than one browser window is open at a time, then the
> @note.property_id is set to whatever window was opened last, rather than
> the using the id from the property view that linked to the create
> action. This can result in notes being assigned to the wrong
> property--ugh!
>
> How can I *safely* propagate the property.id to note.property_id if I'm
> not using a nested form? I don't want to pass it as a hidden form field
> (vulnerable to tampering by the client), and I can't necessarily trust
> request.referer either, except possibly to validate whether the session
> value matches the referer.
>
> I can't be the first person to encounter this sort of issue. What is a
> good rails-centric way of doing this securely?
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"

--

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




[Rails] Re: Authlogic and Restful Authentication - Security Issues

2009-11-15 Thread Eric

Just out of curiosity, by "certain developers" are you referring only
to developers that you work with? Is "some manager," your manager?
Because if that's the case, they should be able (and I'd say have a
duty) to explain. Do you have any examples otherwise?

For what its worth, your question is the top Google search result from
a query about fixing authlogic session problems with a VPS.

-eric

On Nov 10, 7:25 pm, Katherine  wrote:
> Greetings. I need to know an expert's opinion on Authlogic and Restful
> Authentication as to security.
> I have used both and I personally like Authlogic precisely because it
> is more flexible.
>
> As to security I am not aware of any risk as long as the authlogic
> examples are followed. However I need to know why certain developers
> feel that using Authlogic imposes security risks.
>
> It's like some manager tells you "your application is not secure
> because you are using authlogic" without clearly explaining why.
--~--~-~--~~~---~--~~
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 extend a RESTful route?

2009-11-13 Thread Eric

Well, you could add a 'publish' action to your Document controller and
add a 'publish' route. Have you looked at any Rails tutorials yet?

-eric

On Nov 13, 9:30 am, explainer  wrote:
> I used the scaffold option to generate a RESTful set of routes to a
> Document model.  All works as described.  Now, I wish to extend the
> controller to add a 'publish' action on DocumentController and add a
> 'publish' route to mimic what the generated 'create' action does.  How
> do I specify this in the routes.rb file?  BTW, I need to keep the
> create action as generated.
--~--~-~--~~~---~--~~
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: Getting the last record for an each loop?

2009-11-12 Thread Eric

tasks.each_with_index do |task, index|
...
<%= content_tag(:hr) unless index == tasks.size %>

might need a +1 on either of index or .size, but that's the idea.

-eric


On Nov 12, 5:58 pm, Tony Tony 
wrote:
> Hi all,
>
> I need a very similar functionality to what is displayed on the group_by
> Month railscast (http://railscasts.com/episodes/29-group-by-month).
>
> The code is this...
>
> <% @task_months.sort.each do |month, tasks| %>
>   <%= month.strftime('%B') %>
>   <% for task in tasks %>
>     
>       <%= task.name %>
>       due on <%= task.due_at.to_date.to_s(:long) %>
>     
>   <% end %>
>
>     
>
> <% end %>
>
> The HR tag above is what I need to not show in the page. I know I could
> this easily in a for loop with something like:
>
> <% for task in tasks %>
>   <%= '' unless task == tasks.last %>
>   ...
>
> Anyone have any clue how to do this with an each loop?
>
> Many thanks!
> -Tony
> --
> 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: Trading Google Wave invites for host!

2009-11-11 Thread Eric

Not OK.

On Nov 11, 9:16 am, Tim Mcd  wrote:
> Trading up to 10 google wave invites for a fast, powerful Rails host
> that provides me with a top level domain: ie: webwebwebwebweb.com or
> w.com
>
> Or similar offers. Send me an email or post here.
> --
> 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: possible to set flash within link_to?

2009-11-10 Thread Eric

On Nov 10, 5:06 pm, Arif Bandali 
wrote:

> i want to set the flash in a link_to similar to below:
> <%= (link_to "SEND", {:controller => "company", :action => "show", :id
> => current_company.id}) %>

If a flash is set in that code snippet, I sure can't find it.
--~--~-~--~~~---~--~~
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: is Rails a CMS ?

2009-11-09 Thread Eric

This isn't the appropriate venue for your blogspam.

-eric

On Nov 9, 12:21 pm, Gaspard Bucher 
wrote:
> Leonardo Mateo wrote:
> > On Mon, Nov 9, 2009 at 3:38 PM, Gaspard Bucher
> >  wrote:
>
> >> Hi list !
>
> >> More often then not when talking about zena, I find people saying that
> >> "we don't need no freakin' CMS, Rails *is* a CMS".
> > Oh come on! Seriously?
>
> In fact, the complete argument is that Rails with generic plugins = CMS.
> But these arguments mostly date from the early ages of the CMS page on
> rails' first wiki when people were discovering REST, pretty urls and
> scaffolding...
>
>
>
>
>
> >> I posted an article on zenadmin.org with some reflections around this
> >> issue and why some people find it useful to build such tools for rails
> >> (adva-cms, radiant, zena):
>
> >>http://bit.ly/2rJa6D
>
> >> Gaspard
> >> --
>
> > --
> > Leonardo Mateo.
> > There's no place like ~
>
> --
> 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: dynamic collection_select

2009-11-09 Thread Eric

Typically for a form, with a "submit" button.

-eric

On Nov 9, 10:08 am, Brian Harnett 
wrote:
> Michal Burak wrote:
> > I think you need AJAX here to populate the cascade "rest of the drop
> > downs" or refresh the whole page on change of the first drop down and
> > feed the collection_seelct in the controller with appropriate data.
>
> Damn,
> I was hoping I wouldn't have to do that.  I know there is some AJAX that
> is included with ROR, anyway to envoke that her?  How about an easier
> one - once I have selected my value in a collection_select, what do I do
> next - how do I pass that selected value back into a controller for
> another page - with the results based on that one dropdown box?
> --
> 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: Multiple Model Form

2009-11-07 Thread Eric

mandatory viewing: http://railscasts.com/episodes/73-complex-forms-part-1

you'll probably benefit from watching all of them.

-eric

On Nov 7, 3:31 pm, eggie5  wrote:
> I created scaffolding for my Model x, but I want to modify the new
> view so that I can create multiple (3) x objects in the DB instead of
> just 1 at a time. How can I do this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Custom Validations Altering Variable

2009-11-07 Thread Eric

I don't agree.

Best,
Eric

On Nov 7, 10:22 am, Marnen Laibow-Koser  wrote:
> Eric wrote:
> > I would put this in a callback in the controller. I suggest starting
> > at before_save and go from there.
>
> That would work, but I think it's conceptually wrong for what the OP
> wants.
>
> > -eric
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> 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: Custom Validations Altering Variable

2009-11-07 Thread Eric

I would put this in a callback in the controller. I suggest starting
at before_save and go from there.

-eric

On Nov 7, 8:05 am, 7H3LaughingMan  wrote:
> I would like to know if it is possible to alter a variable during the
> process of a custom validation. I know that it is no longer validation
> when your altering data but in my opinion there are times when you
> need alter it for simplicity sakes. A good example would be for a
> world wide auction house type application and to to convert currency
> to one single format, when you validate you check to see if both the
> amount is alright along with the currency type. (This is assuming you
> can type in what type of currency it is, and for this example is
> possible.)
>
> The application I am developing allows the user to type in multiple
> currencies at one (This is a D20 RPG, and people type in something
> along the line of 12 pp 145 gp 78 sp 21 cp) and so far the validation
> process involves converting it all to the lowest currency type. But
> for the sake of being DRY I would only need to add another line to set
> the variable, but instead it is looking like I would have to repeat
> the whole method and add in the single line and change it that way on
> creation and updates.
--~--~-~--~~~---~--~~
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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

Yes!

Conrad...you are the man.

after a restart and the export path command, I was able to run
sudo gem update --system successfully

so now...

which gem
/usr/bin/gem

gem -v
1.3.5

which ruby
/usr/bin/ruby

ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

This has been making my head spin all day.  I really appreciate the 
help.  Are there any other commands I need to run to get everything 
running smoothly in Snow Leopard?


Conrad Taylor wrote:
> On Thu, Nov 5, 2009 at 10:32 PM, Conrad Taylor  
> wrote:
> 
>>>
>>>
>>
>>>
>>>
>>>
> Did you use the Disk Utility app to "Repair Disk Permissions" on the 
> system
> disk?
> 
> -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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

stripped the sbin part out...

Ran all the commands-

which gem
/usr/local/bin/gem

gem -v
Illegal instruction

which ruby
/usr/local/bin/ruby

ruby -v
Illegal instruction

echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

(I also downloaded the latest iphone developer kit and installed it to 
be safe)









Conrad Taylor wrote:
> On Thu, Nov 5, 2009 at 10:19 PM, Conrad Taylor  
> wrote:
> 
>>> I changed it to this
>>
>> which gem
>> gem -v
>> which ruby
>> ruby -v
>>
>> -Conrad
>>
>>
> What does the following say?
> 
> echo $PATH
> 
> -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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

I ran

mate ~/.profile

It looked like this
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I changed it to this
export PATH="/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I opened up a new shell and ran
sudo gem update --system

Still got a segmentation fault.

Conrad Taylor wrote:
> OK, let's do the following for now:
> 
> 1). Remove /use/local/bin from your
>   PATH.
> 
> 2).  Open a new shell window
> 
> 3).  Update Rubygems
> 
>sudo gem update --system
> 
> 4).  Install Rails
> 
>sudo gem install rails
> 
> Let me know what happen.
> 
> -Conrad
> 
> Sent from my iPhone
> 
> On Nov 5, 2009, at 7:38 PM, Eric Ee 

-- 
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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

Sure thing.  Thank you.  Seriously.

gem -v
Illegal instruction (yikes)

which gem
/usr/local/bin/gem

which ruby
/usr/local/bin/ruby


Conrad Taylor wrote:
> On Thu, Nov 5, 2009 at 7:28 PM, Conrad Taylor  
> wrote:
> 
>>>
>> Next, what the version of Ruby that you're using?  Also,
>> when you type `gem -v`, what appears on the screen?
>>
>> -Conrad
>>
> 
> Also, can you send the output of the following commands?
> 
> which gem
> which ruby
> 
> -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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

Yes,

I've got the snow leopard DVD.  Went into optional installs and 
installed Xcode.mpkg before I started any of this.  Got a nice checkmark 
saying it installed properly.

still getting segmentation faults with just about everything.

Conrad Taylor wrote:
> On Thu, Nov 5, 2009 at 6:57 PM, Eric Ee 
> wrote:
> 
>>
>> Thanks Conrad,
>>
>> However, I also get a segmentation fault when I run
>>
>> sudo gem update --system
>>
>>
>>
> Did you install the latest version of developer tools for Snow Leopard?
> 
> -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: Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

Thanks Conrad,

However, I also get a segmentation fault when I run

sudo gem update --system


Conrad Taylor wrote:
> On Thu, Nov 5, 2009 at 6:07 PM, Eric Ee 
> wrote:
> 
>>
>> Which should be right.  However, when I go to install rubygems...
>> sudo /usr/local/bin/ruby setup.rb
>>
>> I get a segmentation fault.  No matter what I try to do I get a
>> segmentation fault.  My app was running just fine before the upgrade to
>> snow leopard and now none of my rake commands work, nothing but
>> segmentation faults.  I'm stumped.  Thanks in advance.
>>
>> -E
>>
> 
> If you have Snow Leopard, then you should have following these 
> instructions
> to install Rubygems:
> 
> sudo gem update --system
> 
> Also, you can find further details here:
> 
> http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
> 
> 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] Segmentation Fault in Snow Leopard

2009-11-05 Thread Eric Ee

I just upgraded to snow leopard and I'm trying to get the 64 bit version
of mysql and ruby going.  I ran through the steps here...

http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/

mysql is running properly and when I run
which ruby   I get...
/usr/local/bin/ruby

Which should be right.  However, when I go to install rubygems...
sudo /usr/local/bin/ruby setup.rb

I get a segmentation fault.  No matter what I try to do I get a
segmentation fault.  My app was running just fine before the upgrade to
snow leopard and now none of my rake commands work, nothing but
segmentation faults.  I'm stumped.  Thanks in advance.

-E
-- 
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: Ruby QR code decoder?

2009-11-01 Thread Eric

Just that in 10 months of asap you could have implemented any of:

http://stackoverflow.com/questions/231741/qr-code-2d-barcode-coding-and-decoding-algorithms

Nothing personal, just sayin'. And yeah, there seem to be any number
of system call solutions.

-eric

On Nov 1, 12:09 pm, ckundo  wrote:
> Eric: Why so incredulous? My point is that I'd rather prototype
> something quickly for user testing before I try learn a completely new
> language.
>
> To anyone else interested: I found out how to execute java using %x|
> java ...| . I think latency would be an issue in the scenario I'm
> describing, but I'm going to give it a shot.
>
> Cameron
>
> On Oct 31, 7:52 pm, Eric  wrote:
>
> > i don't mean to be a jerk, but "asap?" really?
>
> >http://www.ruby-forum.com/topic/198410
>
> > -eric
>
> > On Oct 31, 3:17 pm, ckundo  wrote:
>
> > > I'd like to use be able to decodeQRcodes that people submit to my
> > > rails app. I'm using phonegap for iPhone, so I need to create a work-
> > > around for a nativeQRcodereader. The best I can come up with is
> > > having someone take a picture of thecodeand submit it, then have
> > > ruby parse it.*
>
> > > I've searched this forum and online, and all I can find is the zxing
> > > library for Java. Question is:
>
> > > a) is there a rails plugin or a ruby gem that can decode aqrcode
> > > image
> > > or b) is it possible to run a java command from ruby?
>
> > > Thanks for any guidance.
>
> > > Cameron
>
> > > *yes, I will be looking into obj-c eventually, but want to prototype
> > > asap
--~--~-~--~~~---~--~~
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 QR code decoder?

2009-10-31 Thread Eric

i don't mean to be a jerk, but "asap?" really?

http://www.ruby-forum.com/topic/198410

-eric

On Oct 31, 3:17 pm, ckundo  wrote:
> I'd like to use be able to decode QR codes that people submit to my
> rails app. I'm using phonegap for iPhone, so I need to create a work-
> around for a native QR code reader. The best I can come up with is
> having someone take a picture of the code and submit it, then have
> ruby parse it.*
>
> I've searched this forum and online, and all I can find is the zxing
> library for Java. Question is:
>
> a) is there a rails plugin or a ruby gem that can decode a qr code
> image
> or b) is it possible to run a java command from ruby?
>
> Thanks for any guidance.
>
> Cameron
>
> *yes, I will be looking into obj-c eventually, but want to prototype
> asap
--~--~-~--~~~---~--~~
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: *** PLEASE HELP!! *** NoMethodError in AvatarController#upload

2009-10-31 Thread Eric

You probably could have included that error in your post. I don't
see .delete in your method, so I'm guessing it's somewhere deeper.
Typically, error messages have line number, so that's something to
check.

On Oct 31, 10:10 am, RubyonRails_newbie 
wrote:
> hub_url isn't causing an issue at the moment,
>
> it's this:
>
> NoMethodError in AvatarController#upload
> You have a nil object when you didn't expect it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.delete
>
> On 31 Oct, 17:04, Eric  wrote:
>
> > Fred's right. If hub_url is news to you, it's probably either a bug in
> > the book or a skipped section by you.
>
> > -eric
>
> > On Oct 31, 6:59 am, RubyonRails_newbie 
> > wrote:
>
> > > There's nothing in the routes.rb file for this section, so am assuming
> > > it hasnt been affected by that,
>
> > > On 31 Oct, 13:06, Frederick Cheung  wrote:
>
> > > > On Oct 31, 12:47 pm, RubyonRails_newbie 
> > > > wrote:
>
> > > > >   def index
> > > > >   #  redirect_to hub_url
> > > > >   end
>
> > > > > The error with this code in place reads: undefined local variable or
> > > > > method `hub_url. This is displayed upon accessing url 
> > > > > :http://localhost:3000/avatar
>
> > > > > Can anyone help?
>
> > > > Nothing to do with your upload function itself - the hub_url method
> > > > gets created when you declared a named_route called hub in your
> > > > routes.rb - your book probably describes that in more detail if you
> > > > need it
>
> > > > Fred
>
> > > > > I might look for another tutorial to upload avatars, but was hoping
> > > > > there would be a simple solution..
>
> > > > > Cheers!
--~--~-~--~~~---~--~~
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: *** PLEASE HELP!! *** NoMethodError in AvatarController#upload

2009-10-31 Thread Eric

Fred's right. If hub_url is news to you, it's probably either a bug in
the book or a skipped section by you.

-eric

On Oct 31, 6:59 am, RubyonRails_newbie 
wrote:
> There's nothing in the routes.rb file for this section, so am assuming
> it hasnt been affected by that,
>
> On 31 Oct, 13:06, Frederick Cheung  wrote:
>
> > On Oct 31, 12:47 pm, RubyonRails_newbie 
> > wrote:
>
> > >   def index
> > >   #  redirect_to hub_url
> > >   end
>
> > > The error with this code in place reads: undefined local variable or
> > > method `hub_url. This is displayed upon accessing url 
> > > :http://localhost:3000/avatar
>
> > > Can anyone help?
>
> > Nothing to do with your upload function itself - the hub_url method
> > gets created when you declared a named_route called hub in your
> > routes.rb - your book probably describes that in more detail if you
> > need it
>
> > Fred
>
> > > I might look for another tutorial to upload avatars, but was hoping
> > > there would be a simple solution..
>
> > > Cheers!
--~--~-~--~~~---~--~~
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: What is the future of Ruby on Rails? MySQL? Compare with Java, MS SQL or Oracle?

2009-10-29 Thread Eric

On Oct 28, 1:51 pm, Suki  wrote:
> Just got into this ROR world, and wondering  around! Would like to
> hear what others think about  ROR.

Personally? I like it.

-eric
--~--~-~--~~~---~--~~
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: activerecord has_many vs. has_one scope

2009-10-27 Thread Eric

You appear to be trying to fit has_one into an implementation it
wasn't designed for. The has_one is supposed to be exactly that:
ThingContainer has_one Thing, but you actually have ThingContainer
has_many :things # well, really one of each of different kinds.

There are likely several ways to handle this situation, but my
instinct is to use named scopes for the color finds and validations to
enforce the one-of-each. Another way would be to use STI to set up
color models that inherit from Thing, with the has_ones from
ThingContainer pointing to each.

-eric

On Oct 27, 1:47 pm, Chris Drappier  wrote:
> Hi All,
>
> in the api for has_many, under the :conditions option we see :
>
>     Specify the conditions that the associated objects must meet in order to
> be included as a WHERE SQL fragment, such as price > 5 AND name LIKE ‘B%’.
> Record creations from the association are scoped if a hash is used.
> has_many<http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M001885&na...>:posts,
> :conditions => {:published => true}will create published posts with
> @blog.posts.create or @blog.posts.build.
>
> however, in the api for has_one under the :conditions option we see :
>
>     Specify the conditions that the associated object must meet in order to
> be included as a WHERE SQL fragment, such as rank = 5.
>
> So, we can't automatically scope associated has_one records by conditions
> like we can has_many. seems to me that the behavior should be the same in
> both situations.
>
> I have a model with relationships like this
>
> class ThingContainer < AR::Base
>   has_one :blue_thing, :class_name => "Thing", :conditions => {:color =>
> "blue"}
>   has_one :red_thing, :class_name => "Thing", :conditions => {:color =>
> "red"}
> end
>
> class Thing < AR::Base
>   belongs_to :thing_container
> end
>
> but when I call ThingContainer.build_blue_thing, it does not populate the
> color attribute. is this by design? or something that was simply left out?
>
> -C
--~--~-~--~~~---~--~~
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: "<%= %>", "<%- %>" and "<% -%>"

2009-10-21 Thread Eric

the hyphens suppress newlines. i'm not sure if the single versions are
equal, but i double them up just out of habit: <%- ... -%>

-eric

On Oct 21, 12:21 pm, Duke Yamamoto 
wrote:
> When I want to show output,
> "<%= %>"
> When I do not want to show output,
> "<%- %>" or "<% %>"
> What about this?
> "<% -%>"
> Is this same as "<%- %>"?
>
> -duke
> --
> 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 generator fails to generate all files

2009-10-21 Thread Eric

`rails myproject -d mysql -t` will get you a backtrace.

-eric

On Oct 21, 9:30 am, Arthur Rats 
wrote:
> Hi Marnen
>
> Yes did look into the locations - its Ruby 1.9 playing up,
> uninstalled/re installed Rails gem didnt make any difference
>
> went back to 1.8.7 and then re installed rails 2.3.4 again and the files
> appear, gem works ok
>
> Looks like another glitch with 2.3.4 and ruby 1.9 on Windows.
>
> Is there a log for the rails generator to trace where it goes wrong?
>
> Thanks
> Art
> --
> 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: Deploying rails application

2009-10-19 Thread Eric

script/server -h

-eric

On Oct 18, 6:19 pm, Josh6847  wrote:
> I am looking to set my rails application into production mode. Does
> anyone have easy instructions on this or good documentation?
>
> Thanks in advance.
>
> Josh
--~--~-~--~~~---~--~~
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: Project Server not starting. No Errors.

2009-10-18 Thread Eric

The app was written for an older version of rails, do you have those
versions installed?

-eric

On Oct 18, 8:21 pm, Peter Warrick 
wrote:
> Eric wrote:
> > versions? check script\about
>
> > On Oct 18, 5:27 pm, Peter Warrick 
>
> Eric,
>
> Thanks for the reply and the help.. This is what script/about reported..
>
> About your application's environment
> Ruby version                 1.8.7 (universal-darwin10.0)
> RubyGems version             1.3.1
> Rails version                1.2.3
> Active Record version        1.15.3
> Action Pack version          1.13.3
> Action Web Service version   1.2.3
> Action Mailer version        1.3.3
> Active Support version       1.4.2
> Application root             /Users/peter/Development/RadRails
> Workspace/rails_space
> Environment                  development
> Database adapter             postgresql
>
> Peter
> --
> 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: Project Server not starting. No Errors.

2009-10-18 Thread Eric

versions? check script\about

On Oct 18, 5:27 pm, Peter Warrick 
wrote:
> I apologize if this has been asked before.
>
> I'm trying to simply start my server and the only output is as
> follows...
>
> ruby script/server
> ./script/../config/boot.rb:26:Warning: Gem::SourceIndex#search support
> for String patterns is deprecated
>
> The server is not started up. Netstat shows nothing listening on port
> 3000. I haven't done any changes to the configs at all since it worked.
> The script is just sitting there.
>
> Any quick ideas?
>
> Thank you.
>
> Peter
> --
> 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: how do I tell people about my open source Rails project?

2009-10-16 Thread Eric

here's one: http://www.google.com/addurl/

On Oct 16, 12:12 pm, Jason  wrote:
> I have a site built in RoR that I would to tell people about. Is there
> some list of RoR projects that people look at? How do I submit my site
> to that list? It iswww.hyop.org.
>
> 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: Am I reinventing polymorphic associations?

2009-10-15 Thread Eric

I think you are. I'd make Comment polymorphic, a nested set, and
has_many :subscribers, which should be based on the top parent of the
comment thread.

-eric

On Oct 15, 4:32 pm, Scott Johnson  wrote:
> Am I reinventing polymorphic associations?
>
> I have a fairly standard blog with comments model, with the following
> additions:
>
> (1) Multiple models can accept comments (blog post, bug report, etc).
>
> (2) Each group of comments has a list of subscribers that will be
> emailed when a new comment is posted.
>
> Requirement (1) leads me to a polymorphic association. But I can't see
> how to fit requirement (2) into that. Each group of comments needs
> some place to store the list of subscribers.
>
> So I added a CommentGroup table.
>
> class BlogPost < ActiveRecord::Base
>   belongs_to :comment_group
> end
>
> class BugReport < ActiveRecord::Base
>   belongs_to :comment_group
> end
>
> class CommentGroup < ActiveRecord::Base
>   has_one :blog_post
>   has_one :bug_report # note: one or the other will be nil
>
>   has_and_belongs_to_many :subscribers
> end
>
> class Comment < ActiveRecord::Base
>   belongs_to :comment_group
> end
> 
>
> But now table :comment_group only has one field: id. And that just
> seems wrong to me.
>
> Is that bad?
--~--~-~--~~~---~--~~
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: Really need some help with production environment installation

2009-10-14 Thread Eric

J,

Can you paste in exactly what is in your PATH now? That might help
clear up where the problem is. And yes, if you are following the
Hivelogic instructions for the Ruby/Rails/Gem install you will need
something in your PATH.


On Oct 14, 8:49 am, Jez  wrote:
> Hello again,
> Ok ive removed that from my path, and still get similar error
>
> $ sudo gem update --system
> Password:
> /usr/local/lib/ruby/1.8/thread.rb:5:in `require': no such file to load
> -- thread.so (LoadError)
>         from /usr/local/lib/ruby/1.8/thread.rb:5
>         from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10:in `require'
>         from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10
>         from /usr/local/bin/gem:8:in `require'
>         from /usr/local/bin/gem:8
>
> Sorry if im missing something.
> Should my path contain anything at all?
> thanks
>
> J
>
> On 14 Oct, 13:18, Conrad Taylor  wrote:
>
>
>
> > Hi, please remove the following from your path:
>
> > /usr/local/bin
> > /usr/local/sbin
>
> > Then open a new shell and try the commands that I specify
> > below.
>
> > -Conrad
>
> > On Wed, Oct 14, 2009 at 4:21 AM, Jez  wrote:
>
> > > Ok so no joy there, still getting exact same messages
>
> > >  sudo gem update --system
> > > /usr/local/lib/ruby/1.8/thread.rb:5:in `require': no such file to load
> > > -- thread.so (LoadError)
> > >        from /usr/local/lib/ruby/1.8/thread.rb:5
> > >        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10:in `require'
> > >        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10
> > >        from /usr/local/bin/gem:8:in `require'
> > >        from /usr/local/bin/gem:8
>
> > > Any ideas now?
> > > ta
>
> > > J
> > > again any help is most appreciated.
>
> > > On 14 Oct, 11:56, Conrad Taylor  wrote:
> > > > On Wed, Oct 14, 2009 at 2:22 AM, Jez  wrote:
>
> > > > > Hi All.
> > > > > Ive heard so much about RoR now Iand i would really like to get my
> > > > > hands dirty. Only trouble is i just cant seem to get it up and
> > > > > running:
>
> > > > > Ive followed the hivelogic instructions several times on two different
> > > > > mac's.
> > > > >  when i start an app, and then try to $script/server, i get a message
> > > > > telling me:
> > > > > " i dont have ruby gems and to install it
>
> > > > > upon trying to install it  again:
>
> > > > > $ sudo gem install rails
> > > > > /usr/local/lib/ruby/1.8/thread.rb:5:in `require': no such file to load
> > > > > -- thread.so (LoadError)
> > > > >        from /usr/local/lib/ruby/1.8/thread.rb:5
> > > > >        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10:in
> > > `require'
> > > > >        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:10
> > > > >        from /usr/local/bin/gem:8:in `require'
> > > > >        from /usr/local/bin/gem:8
>
> > > > > there seems to be conflicting paths / versions of rubygems, i cant
> > > > > tell which. either way somethings pointing to the wrong thing. Please
> > > > > could anyone help?
> > > > > Much Appreciated
>
> > > > > Jez
>
> > > > Hi, you could have simply used the currently installed version of Ruby
> > > > and Rubygems located in /usr/bin.  Then you could have simply performed
> > > > the following steps:
>
> > > > sudo gem update --system
> > > > sudo gem install gemcutter
> > > > sudo gem install jeweler
> > > > gem tumble
> > > > sudo gem install sqlite3-ruby
> > > > sudo gem install rails
>
> > > > Good luck,
>
> > > > -Conrad
--~--~-~--~~~---~--~~
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: newcomer of ROR

2009-10-05 Thread Eric

On Oct 5, 12:36 pm, silver  wrote:
> But I have trouble with how to do it. I want to call the category's
> list action from blog/list.rhtml but I don't know how to do it.

What have you tried so far?

-eric
--~--~-~--~~~---~--~~
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] doing creates on has_many_through associations with :conditions?

2009-10-05 Thread Eric Hahn

I'm confused about something I thought should work. I have tables Users and 
Blogs, joined together through Memberships.  Membership also has a boolean for 
moderator-ness.  So, the Blog model looks like this:

class Blog < ActiveRecord::Base
  has_many :memberships

  has_many :users,
   :through => :memberships
  
  has_many :moderators,
   :through => :memberships,
   :source => :user,
   :conditions => { :memberships => {:moderator => true} } 
end

Imagine something trivial like this:

b = Blog.create(:name => 'politics')
user1 = User.create(:name => 'billg')
user2 = User.create(:name => 'dhh')

b.users << user1
b.moderators << user1
b.save!

I see this

b.memberships
++-+-+---+
| id | user_id | blog_id | moderator |
| 1  | 1   | 1   |   | 
| 2  | 2   | 1   |   |
++-+-+---+

Which seems plain wrong.  I'd think the moderator column should be 't' for the 
second user's membership since he was added via the :moderators association 
which has a conditions clause.

What am I misunderstanding?  Thanks much.

-Eric

ps: Rails 2.3.4

pps: no apparent difference if I rewrite the conditions to array-style.

ppps: it has been mentioned that ticket #2998 
https://rails.lighthouseapp.com/projects/8994/tickets/2998 is related, but that 
seems to be about the query side, not the record-creation side.
 

--~--~-~--~~~---~--~~
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: Knowing the parent of an object

2009-10-03 Thread Eric

> I totally agree, but it would be convenient to obtain an array of
> multiple parents.  Something like:
>
> parents = @article.belongs_to
> parents # => ["Magazine", "Category"]

Look into reflections, there should be something in there you can rely
on.

-eric
--~--~-~--~~~---~--~~
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: App isn't querying db on server, but works in development

2009-09-30 Thread Eric Gruber

I thought I'd revisit this and say that I ended up getting this
working, with a change in query.

I tried running the query in MySQL and it still didn’t work. But, when
I took out the “or answer” part (|| answer), it did. A friend of mine
told me I had my || in the wrong order for MySQL (though strangely
enough, not for SQLite3).

All I needed to do was to change my SQL query in the controller from
this:

(LOWER(question || answer) LIKE ?)

To this:

(LOWER(question)) || (LOWER(answer)) LIKE ?

And voila! It worked. Thanks to Hassan to get me to think outside the
box to find a way to troubleshoot.

Eric

On Sep 21, 8:42 pm, Eric Gruber  wrote:
> Sorry for the delay, I've been out of town.
>
> Here's the query from the terminal on my development machine, with a
> known good term (fire):
>
> Processing PostsController#get_results (for 127.0.0.1 at 2009-09-21
> 20:36:34) [POST]
>   Parameters: {"authenticity_token"=>"q5E5x7rV3Xvz8EPJ/WyQcFA5xcCgZN
> +6CLWdW19rJ6A=", "search_text"=>"fire"}
>   Post Load (0.3ms)   SELECT * FROM `posts` WHERE ((LOWER(question ||
> answer) LIKE '%fire%'))
> Rendered posts/_search (0.6ms)
> Completed in 19ms (View: 3, DB: 1) | 200 OK [http://localhost/posts/
> get_results]
>
> And the same entry from the development.log:
>
> Processing PostsController#get_results (for 127.0.0.1 at 2009-09-21
> 20:36:34) [POST]
>   Parameters: {"authenticity_token"=>"q5E5x7rV3Xvz8EPJ/WyQcFA5xcCgZN
> +6CLWdW19rJ6A=", "search_text"=>"fire"}
>   ^[[4;36;1mPost Load (0.3ms)^[[0m   ^[[0;1mSELECT * FROM `posts`
> WHERE ((LOWER(question || answer) LIKE '%fire%')) ^[[0m
> Rendered posts/_search (0.6ms)
> Completed in 19ms (View: 3, DB: 1) | 200 OK [http://localhost/posts/
> get_results]
>
> Thanx,
>
> Eric
>
> On Sep 14, 11:42 pm, Hassan Schroeder 
> wrote:
>
> > On Mon, Sep 14, 2009 at 9:32 AM, Eric Gruber  wrote:
> > > Here's my code for the suspected offending method. Is there something
> > > in that query that wouldn't work with MySQL but OK with SQLite3?
> > >                :conditions => [
> > >                  ( ["(LOWER(question || answer) LIKE ?)"] * terms.size 
> > > ).join(" AND
> > > "), * terms.flatten
> > >                ]
>
> > It kind of depends on what the db adaptor turns this into :-)
>
> > Can you check your MySQL query log to see what this produces?
> > Or for that matter check the error log, as well.
>
> > --
> > Hassan Schroeder  hassan.schroe...@gmail.com
> > twitter: @hassan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

Right on, that worked for me. Thanx so much!

On Sep 30, 12:16 pm, Mauricio Szabo  wrote:
> You must require 'open-uri' to be able to open URLS. For example:
>
> >> open("http://example.com/";).read
>
> Errno::ENOENT: No such file or directory -http://example.com/
>         from (irb):2:in `initialize'
>         from (irb):2:in `open'
>         from (irb):2
>
> But if you require 'open-uri':
>
> >> require 'open-uri'
> => true
> >> open("http://example.com/";).read
>
> => "\r\n\r\n  Example Web Page\r\n \r
> \n  \r\nYou have reached this web page by
> typing"example.com",\r\n"example.net",\r\n  or
> "example.org" into your web browser.\r\nThese domain
> names are reserved for use in documentation and are not available \r
> \n  for registration. See http://www.rfc-editor.org/rfc/
> rfc2606.txt">RFC \r\n  2606, Section 3.\r\n\r\n\r
> \n\r\n"
>
> On Sep 30, 2:07 pm, Eric Gruber  wrote:
>
> > What happened was I got the "We're sorry, but something went wrong."
> > page from my
> > app.
>
> > I would prefer it all to be on one server, but the company I'm trying
> > to do this for has many different projects, using different languages
> > on two different servers. I'd rather not include a copy on the second
> > server, so if I have to make a change to that one file (remember kids,
> > don't repeat yourself!) I have to only do it once on one server.
>
> > On Sep 30, 11:56 am, Marnen Laibow-Koser 
> > s.net> wrote:
> > > Eric Gruber wrote:
> > > > If there's some sort of risk, please inform.
>
> > > I agree, this is a terrible idea from both performance and architectural
> > > perspectives.  Why do you want your navbar to live on another server?
>
> > > > Not that it matters, that didn't work either.
>
> > > What happened when you tried the open().read solution?  Just saying that
> > > it didn't work isn't that helpful.
>
> > > Best,
> > > --
> > > Marnen Laibow-Koserhttp://www.marnen.org
> > > mar...@marnen.org
>
> > > --
> > > 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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

What happened was I got the "We're sorry, but something went wrong."
page from my
app.

I would prefer it all to be on one server, but the company I'm trying
to do this for has many different projects, using different languages
on two different servers. I'd rather not include a copy on the second
server, so if I have to make a change to that one file (remember kids,
don't repeat yourself!) I have to only do it once on one server.


On Sep 30, 11:56 am, Marnen Laibow-Koser  wrote:
> Eric Gruber wrote:
> > If there's some sort of risk, please inform.
>
> I agree, this is a terrible idea from both performance and architectural
> perspectives.  Why do you want your navbar to live on another server?
>
>
>
> > Not that it matters, that didn't work either.
>
> What happened when you tried the open().read solution?  Just saying that
> it didn't work isn't that helpful.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
>
> --
> 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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

What happened was I got the "We're sorry, but something went wrong."
page from my
app.

I would prefer it all to be on one server, but the company I'm trying
to do this for has many different projects, using different languages
on two different servers. I'd rather not include a copy on the second
server, so if I have to make a change to that one file (remember kids,
don't repeat yourself!) I have to only do it once on one server.


On Sep 30, 11:56 am, Marnen Laibow-Koser  wrote:
> Eric Gruber wrote:
> > If there's some sort of risk, please inform.
>
> I agree, this is a terrible idea from both performance and architectural
> perspectives.  Why do you want your navbar to live on another server?
>
>
>
> > Not that it matters, that didn't work either.
>
> What happened when you tried the open().read solution?  Just saying that
> it didn't work isn't that helpful.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
>
> --
> 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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

I should clarify.

1. I control both servers that I'm working with, so the security risk
is practically nil.
2. The app is very small. Any performance hits I'd take by including a
remote file is acceptable.

That said, still don't have a fix.

Thanx.

Eric

On Sep 30, 11:17 am, Eric Gruber  wrote:
> If there's some sort of risk, please inform.
>
> Not that it matters, that didn't work either.
>
> On Sep 30, 11:13 am, John Barnette  wrote:
>
> > On Sep 30, 2009, at 9:06 AM, Eric Gruber wrote:
>
> > > OK ... so is there another way to do it without using render?
>
> > > Surely this isn't something that PHP can do that Rails can't.
>
> > This is a terrible idea. But hey, here, have a loaded gun:
>
> > <%= open("http://example.com/navigation.html";).read %>
>
> > ~ j.
>
> > > On Sep 30, 11:04 am, Eric Gruber  wrote:
> > >> Right. That helps if the file I am using is locally. But what do I do
> > >> if that file is from another server?
>
> > >> On Sep 30, 11:02 am, Greg Donald  wrote:
>
> > >>> On Wed, Sep 30, 2009 at 11:00 AM, Eric Gruber  
> > >>>  wrote:
> > >>>> <%= render :partial => 'http://example.com/navigation.html'%>
>
> > >>> The partial file should be local to the Rails app.
>
> > >>> --
> > >>> Greg Donaldhttp://destiney.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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

If there's some sort of risk, please inform.

Not that it matters, that didn't work either.

On Sep 30, 11:13 am, John Barnette  wrote:
> On Sep 30, 2009, at 9:06 AM, Eric Gruber wrote:
>
> > OK ... so is there another way to do it without using render?
>
> > Surely this isn't something that PHP can do that Rails can't.
>
> This is a terrible idea. But hey, here, have a loaded gun:
>
> <%= open("http://example.com/navigation.html";).read %>
>
> ~ j.
>
>
>
> > On Sep 30, 11:04 am, Eric Gruber  wrote:
> >> Right. That helps if the file I am using is locally. But what do I do
> >> if that file is from another server?
>
> >> On Sep 30, 11:02 am, Greg Donald  wrote:
>
> >>> On Wed, Sep 30, 2009 at 11:00 AM, Eric Gruber  
> >>>  wrote:
> >>>> <%= render :partial => 'http://example.com/navigation.html'%>
>
> >>> The partial file should be local to the Rails app.
>
> >>> --
> >>> Greg Donaldhttp://destiney.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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

OK ... so is there another way to do it without using render?

Surely this isn't something that PHP can do that Rails can't.

On Sep 30, 11:04 am, Eric Gruber  wrote:
> Right. That helps if the file I am using is locally. But what do I do
> if that file is from another server?
>
> On Sep 30, 11:02 am, Greg Donald  wrote:
>
> > On Wed, Sep 30, 2009 at 11:00 AM, Eric Gruber  wrote:
> > > <%= render :partial => 'http://example.com/navigation.html'%>
>
> > The partial file should be local to the Rails app.
>
> > --
> > Greg Donaldhttp://destiney.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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

Right. That helps if the file I am using is locally. But what do I do
if that file is from another server?

On Sep 30, 11:02 am, Greg Donald  wrote:
> On Wed, Sep 30, 2009 at 11:00 AM, Eric Gruber  wrote:
> > <%= render :partial => 'http://example.com/navigation.html'%>
>
> The partial file should be local to the Rails app.
>
> --
> Greg Donaldhttp://destiney.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: What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric Gruber

I tried that, with something like this:


<%= render :partial => 'http://example.com/navigation.html' %>

And I got the "We're sorry, but something went wrong." page from my
app.

I am 100% positive the server I'm trying to include the file from
allows files to re used remotely.


On Sep 30, 10:48 am, Greg Donald  wrote:
> On Wed, Sep 30, 2009 at 10:44 AM, Eric J. Gruber  wrote:
>
>
>
> > If I was to include a file (such as in a template) in php to use
> > across a large number of pages, I would write this:
> > 
>
> > In turn, every time I used this code, it would “include” (or better
> > put, display) the content of navigation.html in the browser.
>
> > I can’t figure out how to do this is Rails. When building my layouts,
> > how can I include a file like this, like I would in PHP. I have files
> > I’d like to include remotely, but not sure how to get this done.
>
> > Any ideas?
>
> render :partial => 'foo/bar'
>
> --
> Greg Donaldhttp://destiney.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] What is the Ruby on Rails equivalent to php includes?

2009-09-30 Thread Eric J. Gruber

If I was to include a file (such as in a template) in php to use
across a large number of pages, I would write this:


In turn, every time I used this code, it would “include” (or better
put, display) the content of navigation.html in the browser.

I can’t figure out how to do this is Rails. When building my layouts,
how can I include a file like this, like I would in PHP. I have files
I’d like to include remotely, but not sure how to get this done.

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: arrays into columns

2009-09-28 Thread Eric

No, not valid; you want an association. Read here:

http://www.google.com/#hl=en&q=rails+database+cardinality

On Sep 27, 4:20 pm, sajeev86  wrote:
> hey (first post jitters..)
> Im a baby in rails web development-please be obvious
>
> How would I get an array as a column set of data?
> Could I just generate the table with:
>
> title:string description:text  list:array
>
> Is array there valid?
>
> If its not possible is there a way to contain a list of data that can
> be added to by the app.
>
> Thanks plenty
--~--~-~--~~~---~--~~
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: App best practice > Client Credit Information

2009-09-27 Thread Eric

Did I read you correctly in that you want to store user credit-card
numbers in your database for some period of time?

-eric

On Sep 27, 3:50 pm, brianp  wrote:
> Hey Everyone,
>
> I'm in the process of laying out a new app for a client. They need to
> be able to receive customers credit information (for a credit check
> done manually) via the website.
>
> So I have a few questions regarding the information.
>
> First I know I'll want to have a secure connection to transfer this
> type of sensitive data. Is there a known tutorial or good read for
> creating a secure connection for a portion of a rails app?
>
> The client had originally asked that the information be e-mailed to
> the person running the check manually. I again am worried about
> sensitive information being sent from the server via email. My
> thinking was store it the db and have the person check the web app for
> output on clients. Again all in a secured environment.
>
> If the sensitive data was being stored in the db if maybe it is a good
> idea to flush it out after a pre-defined period of time. So the
> important information (sin & credit card numbers etc) aren't left
> behind.
>
> What are your opinions?
--~--~-~--~~~---~--~~
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: Editing "Tutorials"

2009-09-24 Thread Eric

What do you mean your tutorials "are stored inside categories?"

Also: rake routes

-eric

On Sep 24, 11:09 am, Joe  wrote:
> Hi, Ive recently bene trying to find a way to edit my tutorials (which
> are stored inside categories) in my RoR app. To edit my category's
> names I use the following in the category show file:
>
> <%= link_to 'Edit', edit_category_path(@category) %>
>
> And this is edit in the categories controller:
>
>   def edit
>     @category = Category.find(params[:id])
>   end
>
> but when I change this to tutorials:
>
> <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> and
>
>  def edit
>     @tutorial = Tutorial.find(params[:id])
>   end
>
> I get this error on the tutorial show page:
>
> undefined method `edit_tutorial_path' for # 0x5ce52fc>
>
> (or something of those origins)
>
> I had the origional category system setup for me, so I dont know that
> much about how the categories are editable. Therefore its hard for me
> to figure out how to edit the tutorials.
>
> Please Help,
>
> (If you need any more information please just ask),
>
> Thanks In Advance,
>
> Joe
--~--~-~--~~~---~--~~
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: Search Pluging , Acts_as_ferret with conditions

2009-09-24 Thread Eric

http://www.google.com/#hl=en&source=hp&q=find_with_ferret+conditions

looks like you might need a nil in the middle, there. check the api.

-eric

On Sep 23, 11:23 pm, Neetal Sharma 
wrote:
> I have a search feature in my application.
> I was using acts_as_ferret , i tried all possible ways to include the
> conditions with it.
>
> Model.find_with_ferret(query, :conditions =>{})
>
> But dint succeed in it. So please some one help me with this , or else
> please suggest a good search plugin which includes conditions. I tried
> with solr but somehow not working because of some java configs and all.I
> don't know java , so have no clue about it.
>
> Please Advice,
>
> Thanks in Advance !
> Neetal
> --
> 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: App isn't querying db on server, but works in development

2009-09-21 Thread Eric Gruber

Sorry for the delay, I've been out of town.

Here's the query from the terminal on my development machine, with a
known good term (fire):

Processing PostsController#get_results (for 127.0.0.1 at 2009-09-21
20:36:34) [POST]
  Parameters: {"authenticity_token"=>"q5E5x7rV3Xvz8EPJ/WyQcFA5xcCgZN
+6CLWdW19rJ6A=", "search_text"=>"fire"}
  Post Load (0.3ms)   SELECT * FROM `posts` WHERE ((LOWER(question ||
answer) LIKE '%fire%'))
Rendered posts/_search (0.6ms)
Completed in 19ms (View: 3, DB: 1) | 200 OK [http://localhost/posts/
get_results]

And the same entry from the development.log:

Processing PostsController#get_results (for 127.0.0.1 at 2009-09-21
20:36:34) [POST]
  Parameters: {"authenticity_token"=>"q5E5x7rV3Xvz8EPJ/WyQcFA5xcCgZN
+6CLWdW19rJ6A=", "search_text"=>"fire"}
  ^[[4;36;1mPost Load (0.3ms)^[[0m   ^[[0;1mSELECT * FROM `posts`
WHERE ((LOWER(question || answer) LIKE '%fire%')) ^[[0m
Rendered posts/_search (0.6ms)
Completed in 19ms (View: 3, DB: 1) | 200 OK [http://localhost/posts/
get_results]

Thanx,

Eric


On Sep 14, 11:42 pm, Hassan Schroeder 
wrote:
> On Mon, Sep 14, 2009 at 9:32 AM, Eric Gruber  wrote:
> > Here's my code for the suspected offending method. Is there something
> > in that query that wouldn't work with MySQL but OK with SQLite3?
> >                :conditions => [
> >                  ( ["(LOWER(question || answer) LIKE ?)"] * terms.size 
> > ).join(" AND
> > "), * terms.flatten
> >                ]
>
> It kind of depends on what the db adaptor turns this into :-)
>
> Can you check your MySQL query log to see what this produces?
> Or for that matter check the error log, as well.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: render :partial => @object

2009-09-20 Thread Eric

Is there something I'm not getting here? The short form should be
either

render :partial => @foo

-or-

render @foo

I've never seen "render :partial @foo"

-eric


On Sep 19, 9:44 pm, Me  wrote:
> Running rails  2.1.0 when I do this:
>
> <%= render :partial => 'style', :collection => @styles %>
>
> I get the collection fine in my index file.  When I try the shortcut:
>
> <%= render :partial �...@styles %>
>
> I get this error:
>
> Couldn't find template file for active_record/named_scope/scopes/
> _scope
>
> 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: Ensuring a password is Alpha-Numeric

2009-09-19 Thread Eric

I'd think the easiest way to allow people to use whatever characters
they want would be not to use validates_format_of at all.

-eric

On Sep 19, 7:06 am, Marnen Laibow-Koser  wrote:
> RubyonRails_newbie wrote:
> > Hi there,
>
> > I am trying to make every effort in making the registration process as
> > secure as possible.
>
> > One way of this, I was told was to ensure that a user registering on
> > the site MUST enter a password that is encrypted in the database
> > (done) and to ensure they enter an alpha numeric password.
>
> If you want security, then don't restrict users to alphanumeric
> passwords.  It's harder to guess passwords if they also contain
> punctuation marks.
>
>
>
>
>
> > in my user.rb file I have various rules of validation, such as
> > password length, email address validation etc..
>
> > I want to make sure users enter an alpha numeric password. so far I
> > have this:
>
> > validates_format_of :password,
> >                       :with => /^[\w\.\-\+]+$/,
> >                       :message => "must contain alpha and numeric
> > characters!"
>
> > However, i can still enter just numerics if i want...
>
> > the above validates_format_of rule was taken from this site:
> >http://guides.rubyonrails.org/security.html#good-passwords
>
> > if i leave the password blank, the message ''must contain alpha and
> > numeric characters!'' does get output on the site, but isn't working
> > as i want...
>
> > Any ideas
>
> You'll need a custom validation routine for this.  A single regex will
> not be sufficient.
>
>
>
> > Thanks for your help!!
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> 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: How to: redirect_to through a folder hierarchy (upwards)

2009-09-19 Thread Eric

Are you creating subdirectories by hand and putting controllers in
them like normal, or are you properly namespacing them? e.g.:

admin/incidents_controller.rb:
IncidentsController < ApplicationController

-or-

admin/incidents_controller.rb:
Admin::IncidentsController < ApplicationController

-eric

On Sep 19, 8:20 am, Tom Ha  wrote:
> Hi there,
>
> how do I tell the current controller correctly to redirect_to an action
> of another controller that is 1 level higher in the folder hierarchy
> than the current controller?
>
> How I have tried: Within the current controller (called 'incidents'), I
> have put:
>
>   redirect_to :controller => 'members', :action => 'show', :id =>
> @user.id
>
> (Where 'members' is 1 level higher. And this doesn't work.)
>
> Thank you for any help with this!
> Tom
> --
> 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: should I chmod gem writable directories?

2009-09-17 Thread Eric

It doesn't really matter and primarily depends on your execution
environment. If you `sudo gem install ...` it will put them in the
system gem directory, if you are installing them as a user, it will
give you that error and create a .gem directory in your home
directory. What's important is that the gems are available to the user
that the app will run under, though if you use the environment.rb
method (typically "config.gem ..."), you can install all of the gems
to that user's environment upon deployment via rake gems:install.

At any rate, you should never have to use a mode of 777. If you think
you do, you're likely Doing It Wrong.

-eric

On Sep 17, 5:55 pm, catel1  wrote:
> I am new to Solaris and new to Ruby. When I install some gem file
> using
> gem install, I get this warning. I'd like to make these gems available
> globally:
>
> bash-3.00$ gem install thor
> WARNING:  Installing to ~/.gem since /opt/coolstack/lib/ruby/gems/1.8
> and
>           /opt/coolstack/bin aren't both writable.
> /opt/coolstack/lib/ruby/site_ruby/1.8/rubygems/installer.rb:149:
> warning: Insecure world writable dir /opt/coolstack/lib/ruby in PATH,
> mode 040777
>
> Should I just chmod 777 /opt/coolstack/lib/ruby/gems/1.8 /opt/
> coolstack/bin
>
> or should I do something else?
--~--~-~--~~~---~--~~
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: Polymorphic STI with associations

2009-09-17 Thread Eric

On Sep 17, 11:10 am, Eric  wrote:
> On Sep 17, 8:44 am, Matt Jones  wrote:
>
>
>
> > On Sep 16, 1:52 pm, Eric  wrote:
>
> > > I have been working on a polymorphic STI schema where the inheriting
> > > classes have associations:
>
> > > class Asset < ActiveRecord::Base
> > > end
>
> > > class Sound < Asset
> > >   belongs_to :user, :polymorphic => true
> > > end
>
> > > class User < ActiveRecord::Base
> > >   has_many :sounds
> > > end
>
> > > The Asset class contains a 'type' attribute which is getting properly
> > > populated with the inheriting class's name, so that's fine, but I was
> > > getting an error that there was no 'user_type':
>
> > > undefined method `user_type' for #
>
> > > OK, so I added 'user_type' to the Asset model and I can get past that
> > > error (which was only raised upon a :destroy for the object). However,
> > > now that I've added it, the user_type is not being populated when new
> > > objects are created/saved. Am I missing something?
>
> > The :polymorphic and the user_type field aren't necessary -
> > polymorphic associations are used when you've got objects from
> > multiple tables that all might be associated to a record, eg:
>
> > class Foo < AR::Base
> >   belongs_to :things, :polymorphic => true
> > end
>
> > class ThingA < AR::Base
> >   has_many :foos, :as => :thing
> > end
>
> > class ThingB < AR::Base
> >   has_many :foos, :as => :thing
> > end
>
> > Note that ThingA and ThingB are in seperate tables - if they were
> > related via STI the :polymorphic wouldn't be needed.
>
> Thanks for the reply, and I did leave a part out of my schema. There
> will be other models inheriting from Asset, such that ultimately there
> will be (at least):
>
> class Asset < ActiveRecord::Base
> end
>
> class Sound < Asset
>   belongs_to :user, :polymorphic => true
> end
>
> class Video < Asset
>   belongs_to :user, :polymorphic => true
> end
>
> class Image < Asset
>   belongs_to :user, :polymorphic => true
> end
>
> class User < ActiveRecord::Base
>   has_many [:sounds,:videos,:images]
> end
>
> The idea will be to have @user.videos, @user.images, etc., so the STI
> will handle the media types, and the polymorphism is used for User's
> relationship to each. However, currently user_id is not being saved
> through the association, and even if I manually set user_id in Asset
> (and user_type, just for fun), Video.first.user comes up nil. So, STI
> is working as expected, but the association is broken in some way that
> leads me to wonder whether Asset needs some connection with User
> (unlikely, given the docs and commentary I've been able to find), or
> whether the STI classes need some more connections to the base class
> in order for User to pass through the STI.
>
> -eric

OK, so setting user_type to "User" manually in the base class does
seem to work. I'm not sure why I couldn't find the user from (e.g.)
@sound before, but that's water under the bridge now. The problem now
seems to be that even though Sound[,Video,etc.] are polymorphic to
User, the user_type attribute in the base class is not getting set
when saved through an inheriting class. Why could this be? Is there
some kind of accepts_nested_attributes_for catch that I'm not
accounting for?

Alternatively, is there a way to see the mechanism by which the type
field is set? More explicit logging, perhaps?

-eric

--~--~-~--~~~---~--~~
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 On Rails Problems

2009-09-17 Thread Eric

Is the category_id datatype a string rather than an integer? Check
your migrations.

-eric

On Sep 17, 9:18 am, Joe  wrote:
> Ive posted the following on various forums and had no reply, and was
> told this was the place were i could get an answer:
>
> Hi, As you may know I currently own and maintain dev-hq.co.uk, and
> basically ive been trying to "convert" everythig to RoR as ive been
> told this could benifit me in many ways. I asked a friend who is good
> in RoR to help me, and we managed to create an application which does
> basically everything its supposed to. However just before finishing
> the project he got bored of helping me time and time again, so there
> are some unfinished bits which I was hoping you could help with. First
> off im going to talk about an error I get when trying to edit/create
> new tutorials in a certain catagory. This is the error I get:
>
> Category(#47881910) expected, got String(#32601110)
>
> Ive looked everywhere for this and cant find a fix that works. Now
> because I dont want to have to post things I dont need too, Im just
> going to post the thing that I put in new and edit to get the catagory
> box to appear (on creation or edit its looking for the catagory number
> by the way):
>
>   
>     <%= f.label :category_id %>
>     <%= f.text_field :category_id %>
>   
>
> So that is my first problem. Secondly since im classed even lower than
> bad in RoR I dont know how I make the tutorials in different
> catagories apear on the catagories page.. If anyone knows how to do
> this please tell me.
>
> Last of all, This is a feature which was not even started yet, next to
> the names of the tutorials on the catagory display page I want to
> display the ammount of tutorials there are in that section in
> brackets, and then have the catagories sorted on the catagory page by
> ammount of tutorials.
>
> I know I have alot to ask, but please help guys..
>
> PS: Sorry for the kind of unhelpful topic title, This topic is asking
> for so much I didnt know what to name it.
>
> Thanks In Advance,
>
> Joe
--~--~-~--~~~---~--~~
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: Polymorphic STI with associations

2009-09-17 Thread Eric

On Sep 17, 8:44 am, Matt Jones  wrote:
> On Sep 16, 1:52 pm, Eric  wrote:
>
> > I have been working on a polymorphic STI schema where the inheriting
> > classes have associations:
>
> > class Asset < ActiveRecord::Base
> > end
>
> > class Sound < Asset
> >   belongs_to :user, :polymorphic => true
> > end
>
> > class User < ActiveRecord::Base
> >   has_many :sounds
> > end
>
> > The Asset class contains a 'type' attribute which is getting properly
> > populated with the inheriting class's name, so that's fine, but I was
> > getting an error that there was no 'user_type':
>
> > undefined method `user_type' for #
>
> > OK, so I added 'user_type' to the Asset model and I can get past that
> > error (which was only raised upon a :destroy for the object). However,
> > now that I've added it, the user_type is not being populated when new
> > objects are created/saved. Am I missing something?
>
> The :polymorphic and the user_type field aren't necessary -
> polymorphic associations are used when you've got objects from
> multiple tables that all might be associated to a record, eg:
>
> class Foo < AR::Base
>   belongs_to :things, :polymorphic => true
> end
>
> class ThingA < AR::Base
>   has_many :foos, :as => :thing
> end
>
> class ThingB < AR::Base
>   has_many :foos, :as => :thing
> end
>
> Note that ThingA and ThingB are in seperate tables - if they were
> related via STI the :polymorphic wouldn't be needed.

Thanks for the reply, and I did leave a part out of my schema. There
will be other models inheriting from Asset, such that ultimately there
will be (at least):

class Asset < ActiveRecord::Base
end

class Sound < Asset
  belongs_to :user, :polymorphic => true
end

class Video < Asset
  belongs_to :user, :polymorphic => true
end

class Image < Asset
  belongs_to :user, :polymorphic => true
end

class User < ActiveRecord::Base
  has_many [:sounds,:videos,:images]
end

The idea will be to have @user.videos, @user.images, etc., so the STI
will handle the media types, and the polymorphism is used for User's
relationship to each. However, currently user_id is not being saved
through the association, and even if I manually set user_id in Asset
(and user_type, just for fun), Video.first.user comes up nil. So, STI
is working as expected, but the association is broken in some way that
leads me to wonder whether Asset needs some connection with User
(unlikely, given the docs and commentary I've been able to find), or
whether the STI classes need some more connections to the base class
in order for User to pass through the STI.

-eric

--~--~-~--~~~---~--~~
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] Polymorphic STI with associations

2009-09-16 Thread Eric

I have been working on a polymorphic STI schema where the inheriting
classes have associations:

class Asset < ActiveRecord::Base
end

class Sound < Asset
  belongs_to :user, :polymorphic => true
end

class User < ActiveRecord::Base
  has_many :sounds
end

The Asset class contains a 'type' attribute which is getting properly
populated with the inheriting class's name, so that's fine, but I was
getting an error that there was no 'user_type':

undefined method `user_type' for #

OK, so I added 'user_type' to the Asset model and I can get past that
error (which was only raised upon a :destroy for the object). However,
now that I've added it, the user_type is not being populated when new
objects are created/saved. Am I missing something?

-eric
--~--~-~--~~~---~--~~
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: App isn't querying db on server, but works in development

2009-09-14 Thread Eric Gruber

Very interesting. I had no idea SQL queries didn't show up in the
production log.

Here's my code for the suspected offending method. Is there something
in that query that wouldn't work with MySQL but OK with SQLite3?

def get_results
if request.xhr?
  if params['search_text'].strip.length > 0
terms = params['search_text'].split.collect do |word|
  "%#{word.downcase}%"
end
@posts = Post.find(
:all,
:conditions => [
  ( ["(LOWER(question || answer) LIKE ?)"] * terms.size 
).join(" AND
"), * terms.flatten
]
  )
end
render :partial => "search"
  else
redirect_to :action => "index"
  end

P.S. You guys are great.

On Sep 12, 11:02 pm, Hassan Schroeder 
wrote:
> On Sat, Sep 12, 2009 at 4:11 PM, Frederick Cheung
>
>  wrote:
> > The default in production mode is not to log SQL queries, so the lack
> > of queries in the log is likely a red herring.
>
> And of course, you can configure MySQL to log queries for you to
> examine separately.
>
> You might also review whether you have some database-specific
> code (e.g. a `conditions => "non-standard-SQL" `) anywhere.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Proper syntax for text_field

2009-09-13 Thread Eric

Text fields don't take actions, they're just text fields with some
optional aesthetics. put :amount in there, and if item.amount exists,
it will be filled in.

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001607

Also, ruby doesn't use This, it's "self."

There may be other problems in find_cart and add_item.

On Sep 13, 12:30 pm, Dudebot  wrote:
> Sorry for this basic noob question:
>
> I have an "Item" class in my models which corresponds to a SQL table,
> and a "Cart" class and a "CartItem" class which do not.  The Item
> class does not have an amount object, which is transitory, so I've put
> this amount object in my CartItem class:
>
> class CartItem
>
>   attr_reader :item, :amount
>
>   def initialize( item )
>     @item = item
>   end
>
>   def set_amount( amount )
>    This.amount = amount
>   end
>
> end
>
> I have a list of items in a viewer form, and I'd like to pass
> associated amount to my CartItem when the user hits the "Add to Cart"
> button. I've tried many variations of text_field and text_field_tag
> in:
>
>         <% @items.each do |item| %>
> ...
>                 <%= text_field( :amount , :action => 'set_amount( :amount )', 
> :id =>
> item )%>
>                 <%= button_to "Add to Cart" , :action => 'add_to_cart', :id 
> => item
> %>
> ...
>         <% end %>
>
> I know the text_field up there is severely mangled and won't work--but
> it's an example of the 2000th try, the last several hundred out of
> pure desperation.  Can anyone help with the proper syntax for the
> text_field in the .html.emb file?
>
> The add_to_cart call with the button is working:
>
>  def add_to_cart
>     item = Item.find( params[ :id ] )
>     @cart = find_cart
>     @cart.add_item( item )
>  end
>
> Many TIA,
> Craig
--~--~-~--~~~---~--~~
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: App isn't querying db on server, but works in development

2009-09-12 Thread Eric Gruber

Any ideas?

On Sep 11, 1:25 pm, "Eric J. Gruber"  wrote:
> I've got a very small app that uses ajax for a live preview. On my
> development machine (using sqlite3), it works just fine. Here is a
> sample of the log with a known good query:
>
> development.log
> ---
> Processing PostsController#get_results (for 127.0.0.1 at 2009-09-11
> 10:59:06) [POST]
>   Parameters: {"authenticity_token"=>"SOME-CODE-HERE=",
> "search_text"=>"?", "_"=>""}
>    [4;36;1mPost Load (0.0ms) [0m    [0;1mSELECT * FROM "posts" WHERE
> ((LOWER(question || answer) LIKE '%?%'))  [0m
> Rendered posts/_search (15.0ms)
> Completed in 15ms (View: 15, DB: 0) | 200 OK [http://localhost/posts/
> get_results]
>
> But on my server (using MySQL), it doesn't produce a result. My gems
> and my application are frozen to Rails 2.3.4. The database is running
> and working, as I am able to view entires using GET queries. But live
> preview isn't working, and there isn't any SQL queries in the
> production log:
>
> production.log
> 
> Processing PostsController#get_results (for555.555.55.55at
> 2009-09-11 11:23:38) [POST]
>   Parameters: {"authenticity_token"=>"SOME-CODE-HERE=",
> "search_text"=>"fire", "_"=>""}
> Completed in 5ms (View: 0, DB: 0) | 200 OK [http://example.com/faq/
> posts/get_results]
> Processing
>
> Any idea what is going on here?
>
> Thanx in advance,
>
> Eric
--~--~-~--~~~---~--~~
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] App isn't querying db on server, but works in development

2009-09-11 Thread Eric J. Gruber

I've got a very small app that uses ajax for a live preview. On my
development machine (using sqlite3), it works just fine. Here is a
sample of the log with a known good query:

development.log
---
Processing PostsController#get_results (for 127.0.0.1 at 2009-09-11
10:59:06) [POST]
  Parameters: {"authenticity_token"=>"SOME-CODE-HERE=",
"search_text"=>"?", "_"=>""}
   [4;36;1mPost Load (0.0ms) [0m[0;1mSELECT * FROM "posts" WHERE
((LOWER(question || answer) LIKE '%?%'))  [0m
Rendered posts/_search (15.0ms)
Completed in 15ms (View: 15, DB: 0) | 200 OK [http://localhost/posts/
get_results]

But on my server (using MySQL), it doesn't produce a result. My gems
and my application are frozen to Rails 2.3.4. The database is running
and working, as I am able to view entires using GET queries. But live
preview isn't working, and there isn't any SQL queries in the
production log:

production.log

Processing PostsController#get_results (for 555.555.55.55 at
2009-09-11 11:23:38) [POST]
  Parameters: {"authenticity_token"=>"SOME-CODE-HERE=",
"search_text"=>"fire", "_"=>""}
Completed in 5ms (View: 0, DB: 0) | 200 OK [http://example.com/faq/
posts/get_results]
Processing

Any idea what is going on here?

Thanx in advance,

Eric

--~--~-~--~~~---~--~~
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: Passenger problem

2009-09-11 Thread Eric Gruber

I should not that this has been resolved.

My problem? I was trying to create another virtual host, when really,
I needed the app to run on the default host for the server.

I added the RailsBaseURI to the default vhost config file, and then it
worked just fine. Thanks for your help!

Eric

On Sep 2, 9:31 am, Jeff  wrote:
> On Sep 1, 1:14 pm,EricJGruber wrote:
>
> > I've used the Slicehost Intrepid instructions (http://
> > articles.slicehost.com/ubuntu-intrepid) to install a new Ubuntu server
> > with Ruby, Rails and passenger.
>
> > Everything seems to be working OK, save for one thing: my application
> > only service up the files that are in its public folder.
>
> > The Passenger gem is installed. I've done this whole process before
> > without any problem. Any thoughts on how I can go about figuing how to
> > fix this?
>
> > Thanx in advance.
>
> A couple questions that might sound dumb, but just to be sure:
>
> - Even though the passenger gem is installed, did you run the
> passenger install script for apache? (passenger-install-apache2-
> module)
> - Is there a line that says PassengerEnabled On; in your vhost?
> - Do you get a 404 or 500 when you go to a Rails url?  Is there
> anything in the rails log file that indicates that it's receiving the
> request?
>
> Jeff
>
> purpleworkshops.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: Counter cache help

2009-09-11 Thread Eric

Singularize your model names: Comment & TestCase

-e

On Sep 10, 8:50 pm, James Englert  wrote:
> My :counter_cache column isn't working properly.
>
> I wouldn't normally ask about a relatively trivial issue like this but I've
> been banging my head on this for a bit and haven't gotten anywhere. I must
> be missing something simple.  Please take a look:
>
> class Comments < ActiveRecord::Base
>   belongs_to :test_case, :counter_cache => true
> end
>
> class TestCases < ActiveRecord::Base
>   has_many :test_case_to_users
>   has_many :comments
>   has_many :users, :through => :test_case_to_users
>
>   named_scope :broken, :conditions => [ "broken = ?", true ]
>   named_scope :fixed, :conditions => [ "broken = ?", false ]
>   named_scope :for_user, lambda { |user_id| { :include => :users,
> :conditions => ["users.id = ?", user_id ] } }
> end
>
> class CreateComments < ActiveRecord::Migration
>   def self.up
>     create_table :comments do |t|
>       t.string :name
>       t.string :body
>
>       t.integer :test_case_id
>
>       t.timestamps
>     end
>   end
>
>   def self.down
>     drop_table :comments
>   end
> end
>
> class CreateTestCases < ActiveRecord::Migration
>   def self.up
>     create_table :test_cases do |t|
>       t.string :name
>       t.boolean :broken, :default => true
>
>       t.integer :comments_count, :default => 0
>
>       t.timestamps
>     end
>   end
>
>   def self.down
>     drop_table :test_cases
>   end
> end
>
> I'm getting the following:
>
> NoMethodError: undefined method `find' for ActiveRecord::TestCase:Class
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/belongs_to_association.rb:44:in
> `find_target'
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:240:in
> `load_target'
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:112:in
> `reload'
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:1231:in
> `test_case'
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:1010:in
> `send'
>     from
> /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:1010:in
> `belongs_to_counter_cache_after_create_for_test_case'
>     from
> /Users/jimenglert/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:178:in
> `send'
>     from
> /Users/jimenglert/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:178:in
> `evaluate_method'
>
> 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: Nesting View Folders

2009-09-10 Thread Eric

It's an aesthetic decision, so...y'know, do what you want, but it's
not necessary since you're introducing complexity in having to
maintain a bunch of of prepend_view_path lines everywhere.

http://en.wikipedia.org/wiki/Convention_over_configuration

On Sep 10, 9:22 pm, Mark Dodwell 
wrote:
> I like to nest my view folders the same way as my resources.
>
> So, if I have:
>
> map.resources :foos do |foos|
>   foos.resources :bars
> end
> map.resources :sums
>
> Then I'll structure my view folders like:
>
> views/
>    foos/
>       bars/
>    sum/
>
> To make this work, I need a tiny little extra line of code in the nested
> controller to tell rails where to look for the templates. Specifically:
>
> prepend_view_path "app/views/foos"
>
> Just curious about people's views on this. Any feedback/criticisms on
> this method?
>
> Thanks,
>
> ~ Mark
> --
> 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: Potential fix to broken session_options in Rails 2.3

2009-09-10 Thread Yves-eric Martin

スクルト神守 wrote:
> hello Martin, Please forgive my terrible english.
> 
> I tried your mokye patch,
> but it didn't work well.

Yes, I just found out myself the patch is only a partial solution: it 
worked on my simple prototype, but once integrated into my production 
system, it stopped working. Like you, I found that "load session" was 
happening before "set option".

The problem is that the session is automatically loaded as soon as 
something tries to use it. So if some plugin uses the session before 
your controller gets control, then the session will be loaded before 
your  before_filter can set the options correctly.

What you can do to find the culprit: use the ruby debugger and add a 
"debugger" statement inside the load_session monkey patch function, then 
run your server with "script/server --debugger". When you try to access 
you site, your console will drop into the debugger, and you can issue a 
"where" command, that will give you a stack trace, so you can find out 
what triggered the call to load_session.

In my case, it was the render_component plugin.

Unfortunately, I do need the render_component plugin (for my admin pages 
that use ActiveScaffold)...


So, the problem is still open... Can anyone help? Should I fill a bug 
report?

--
Yves-Eric Martin
-- 
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: problems with habtm

2009-09-09 Thread Eric

it looks all wrong to me, and overconfigured too. check some
tutorials.

Category habtm :empresas
Empresa habtm :categories

CategoryEmpresa
  belongs_to :category
  belongs_to :empresa

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001836

On Sep 9, 11:28 am, Paŭlo Geyer  wrote:
> hi, i'm having some problems with habtm association, when i try to
> list Empresas form a Category, i get the association ID instead of the
> Empresa ID, i'm using sqlite3
>
> >> paulo-geyers-macbook:100empresas paulo$ ./script/console
>
> Loading development environment (Rails 2.3.4)>> 
> Category.find(:first).empresas.each {|e| puts e.id}
>
> 608
> 609
> => [# created_at: "2009-09-09 17:55:49", updated_at: "2009-09-09 17:55:49">,
> # created_at: "2009-09-09 17:55:49", updated_at: "2009-09-09 17:55:49">]>> 
> Empresa.find(:all).each {|e| puts e.id}
>
> 54276017
> 1387109338
> => [# nil, created_at: "2009-09-09 17:55:49", updated_at: "2009-09-09
> 17:55:49">, # nil, created_at: "2009-09-09 17:55:49", updated_at: "2009-09-09
> 17:55:49">]
>
>
>
> here follows the model codes
> empresa.rb
> class Empresa < ActiveRecord::Base
>   has_and_belongs_to_many :categories, :foreign_key =>
> 'empresa_id', :association_foreign_key => 'category_id'
>   validates_presence_of :name
>   acts_as_voteable
> end
>
> category.rb
> class Category < ActiveRecord::Base
>   has_and_belongs_to_many :empresas, :foreign_key =>
> 'category_id', :association_foreign_key => 'empresa_id'
>   validates_presence_of :name
> end
>
> i've tried to set the keys manually, but didn't work too
>
> thanks,
> Paulo
--~--~-~--~~~---~--~~
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] Potential fix to broken session_options in Rails 2.3

2009-09-08 Thread Yves-eric Martin

Hi all,


Reviving this old thread with a I am developing a site that needs to be 
accessible to mobile phones, and I am having issues with session 
tracking.

While the default "cookie_only" session tracking makes a lot of sense 
(it prevents session fixation attacks), there are these cases when your 
clients do not support cookies (say, many mobile phones, for example) 
and you just need to do request-parameter-based session tracking.

One should be able to use the "cookie_only" session option and set it to 
"false" where appropriate, but this is seriously broken in Rails 2.3. 
>From my tests so far:

1) Setting a default by adding "config.action_controller.session = 
{:cookie_only => false}" in environment.rb DOES work.

2) Inside your controller (say, a before_filter method), 
"request.session_options[:cookie_only] = false" to false will NOT work.

Unfortunately, 1) is not an acceptable solution, as it opens the whole 
site to session fixation attacks.


FWIW, I think I have traced down the culprit to the load_session method 
in active_store.rb around line 165:

  sid = request.cooki...@key]
  unless @cookie_only
sid ||= request.para...@key]
  end

This code becomes a problem in 2.3, because the session has been pushed 
down to the Rack middleware layer, where your abstract_store gets 
initialized once and for all, way before any of your controller code 
gets executed. As a result, your abstract_store's @cookie_only and @key 
are set once and for all, according to the default session options. Any 
further changes to the session_options[:cookie_only] or 
session_options[:key] will simply be ignored.

Here is a tentative monkey patch that restores the proper functionality 
of session_options[:cookie_only] and session_options[:key].

HTH.


###
# Monkey patch to allow per-controller/action setting of :cookie_only
# and :key session options
###

module ActionController
  module Session
class AbstractStore

  private
  def load_session(env)
request = Rack::Request.new(env)
key = request.session_options[:key]
cookie_only = request.session_options[:cookie_only]
sid = request.cookies[key]
unless cookie_only
  sid ||= request.params[key]
end
sid, session = get_session(env, sid)
[sid, session]
  end

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: partials in layouts ?

2009-09-08 Thread Eric

> works.  Seems kind of ugly, though--even in layouts, shouldn't a form
> look in its own directory for a partial?

It does, you're just misunderstanding what "its own directory" refers
to. Your form is not a part of "layouts," it's a part of the
controller rendering it.

On Sep 8, 6:30 am, Dudebot  wrote:
> Thanks--
>
> <%= render :partial => 'layouts/navbar_tabs' %>
>
> works.  Seems kind of ugly, though--even in layouts, shouldn't a form
> look in its own directory for a partial?
>
> Anyway, thanks!
>
> On Sep 8, 7:23 am, Abhinav Saxena  wrote:
>
> > Try giving the whole path in render like this:
>
> > <%= render :partial => '/messages/navbar_tabs' %> # if your partial is in
> > messages directory.
>
> > Let us know if this does not work.
>
> > Thanks,
> > Abhinav
>
> > --
> > अभिनवhttp://twitter.com/abhinav
>
> > On Tue, Sep 8, 2009 at 4:54 PM, Dudebot  wrote:
>
> > > Hi Gurus, how do I include a partial in my main layout?
>
> > > In views/layouts/application.html.erb I have
>
> > > 
> > > ...
> > > <%= render :partial => 'navbar_tabs' %>
> > > ...
> > > 
> > > No matter where I put _navbar_tabs.html.erb (or renamed it to
> > > _navbar_tabs.erb in desperation) I get the error
>
> > > Showing app/views/layouts/application.html.erb where line #20 raised:
>
> > > Missing template messages/_navbar_tabs.erb in view path app/views
>
> > > Can you help?
>
> > > TIA,
> > > Craig
>
>
--~--~-~--~~~---~--~~
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: Controller Actions

2009-09-07 Thread Eric

egrep -r '^ *?def ' /path/to/proj/app/controllers/ >
methods_and_actions.csv

On Sep 7, 10:22 pm, Avantec Van 
wrote:
> Hi All,
>   How do I get all the actions & methods from a no. of controllers &
> export it into excel.
>
> Thanks in Advance,
> Avantec
> --
> 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: Format of a string, array or hash

2009-09-06 Thread Eric

@project.services.collect{|s| s.name}.to_sentence

On Sep 6, 3:33 pm, Hugues Brunelle 
wrote:
> Hello there,
> I do not know if my topic is right so I'll explain the problem :
>
> I have a Project model :
>
> class Project < ActiveRecord::Base
>   has_and_belongs_to_many :services
> end
>
> In my views. I would like to list the services in the title of the page.
>
> I did :
> <% for service in @project.services %-><%= service.name_fr.downcase -%>,
> <% end -%>.
>
> The problem is with the listing itself, it puts this :
> {Project.name} required {service.name1}, {service.name2},
> {service.name3},.
>
> There is a problem with the last comma. It looks awful from a web
> developer view.
>
> I would like :
> {Project.name} required {service.name1}, {service.name2} and
> {service.name3}.
>
> Notice the attribute «and» and «dot» at the end
>
> How do you call that thing I am looking for?
> Is there a way to do it like the second exemple?
>
> Thx a lot for your time and help.
>
> Hugues
> --
> 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: Passenger problem

2009-09-01 Thread Eric J Gruber

Any troubleshooting help is greatly 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] Passenger problem

2009-09-01 Thread Eric J Gruber

I've used the Slicehost Intrepid instructions (http://
articles.slicehost.com/ubuntu-intrepid) to install a new Ubuntu server
with Ruby, Rails and passenger.

Everything seems to be working OK, save for one thing: my application
only service up the files that are in its public folder.

The Passenger gem is installed. I've done this whole process before
without any problem. Any thoughts on how I can go about figuing how to
fix this?

Thanx in advance.

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



[Rails] Re: render :partial erroring with wrong extension

2009-08-28 Thread Eric

Of course it was the one thing I didn't check and was not in the
error: a leading space in the partial's filename. A twitchy typo, and
a proportional font didn't help either.

On Aug 27, 12:46 pm, Eric  wrote:
> I'm thinking that for some reason Rails isn't seeing a content_type so
> is falling back to .erb rather than using .html.erb, but I can't
> figure out how this would happen or why it's not able to find the
> correct file. I encountered this when changing this view from <%=
> render @gigs %>, which finds gigs/_gig.html.erb just fine. I can post
> the contents of _gig_big.html.erb if necessary, but for the most part
> it's just a copy of _gig.html.erb (for now).
>
> View:
> 
>         <%= render :partial => 'gig_big', :collection => @gigs %>
> 
>
> Error:
> ActionView::TemplateError (Missing template gigs/_gig_big.erb in view
> path app/views) on line #9 of app/views/gigs/index.html.erb:
> 6:              <% end %>
> 7:      
> 8:      
> 9:              <%= render :partial => 'gig_big', :collection => @gigs %>
> 10:     
> 11: <% end %>
>
> Partial:
> ../app/views/gigs/_gig_big.html.erb exists
--~--~-~--~~~---~--~~
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] render :partial erroring with wrong extension

2009-08-27 Thread Eric

I'm thinking that for some reason Rails isn't seeing a content_type so
is falling back to .erb rather than using .html.erb, but I can't
figure out how this would happen or why it's not able to find the
correct file. I encountered this when changing this view from <%=
render @gigs %>, which finds gigs/_gig.html.erb just fine. I can post
the contents of _gig_big.html.erb if necessary, but for the most part
it's just a copy of _gig.html.erb (for now).

View:

<%= render :partial => 'gig_big', :collection => @gigs %>


Error:
ActionView::TemplateError (Missing template gigs/_gig_big.erb in view
path app/views) on line #9 of app/views/gigs/index.html.erb:
6:  <% end %>
7:  
8:  
9:  <%= render :partial => 'gig_big', :collection => @gigs %>
10: 
11: <% end %>

Partial:
../app/views/gigs/_gig_big.html.erb exists
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



<    1   2   3   4   >