[Rails] Re: Help with Select

2009-08-28 Thread Quee Mm

Do I need to provide more information for someone to look into this and 
help 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-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] tags with spaces in it issue - acts_as_tagged_on_steriods

2009-08-28 Thread Rails List

I am using acts_as_tagged_on_steriods for tagging which works well for
single word tags.

When clicking on tags with multiple words (tags with spaces in them -
ex: "ruby rails"), spaces are also displayed in URL.

How do I eliminate those spaces in URL?.  I tried using permalink, by
creating a Tag model but it didn't work.

Any ideas?
-- 
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: routing and has_many

2009-08-28 Thread sax

It sounds like your routes are set up alright, but yeah, you'll still
need to add code so your action knows how to handle it.

In your ProductsController#index action, you probably have something
like this?

  @products = Product.all

Since you have category_id in the params, something like this should
work:

  if params[:category_id]
@category = Category.find(params[:category_id])
@products = @category.products
  end

Personally, if I have a controller that's always used as a nested
resource, I put the initialization of the parent into a before_filter,
so it's called for every action.



On Aug 27, 5:54 am, hansfh  wrote:
> Hi,
> im a rails newbie, so please be gentle:
>
> let's say category habtm products and i've got a product with the id
> 7.
>
> when i use the url
>
> /categories/7/products
>
> should the server show me only the categories of product 7?
>
> On my Server it always shows all categories i have.
>
>  How do i solve this the right way?
>
> I edited the routes.rb so, that
>
>   map.resources :categories, :has_many => [:products]
>
> But this does not change anythings, using
> /categories/7/products always leads to the index action of the
> products controller.
>
> Is the right way to test in the index action of the products
> controller whether category_id is set in params and use this
> information to only show products of this category? Or is there a
> better way?
>
> Thanks,
>
> HansFH

--~--~-~--~~~---~--~~
You received 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: Association extension method

2009-08-28 Thread Bryan Ash

David,

thank you so much, that was the correct answer.


My complete association extension is now:

class Dropzone < ActiveRecord::Base
  has_many :transactions, :through => :accounts do
def limited_to(transaction)
  scope = Transaction.scoped({ :conditions =>
['accounts.dropzone_id = ?', proxy_owner.id],
   :include=>
[:account, :payment_method, :slot] })
  scope = scope.scoped :conditions => ['name ILIKE ?', "%#
{transaction.account_name}%"] unless transaction.account_name.blank?
  scope = scope.scoped :conditions => ['payment_method_id = ?',
transaction.payment_method_id] unless
transaction.payment_method_id.blank?
  scope
end
  end
end


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



[Rails] Re: emails - html not rendering

2009-08-28 Thread heimdull

how do you send the email? Is there a controller action that sends the
email?

On Aug 28, 10:19 am, Ritvvij  wrote:
> Hi,
>
> i am using ruby 1.8.7 and rails 2.3.3
> i can send emails using gmail smtp
> my config is:
>
> ActionMailer::Base.raise_delivery_errors = true
> ActionMailer::Base.perform_deliveries = true
> ActionMailer::Base.delivery_method = :smtp
> ActionMailer::Base.default_charset = 'utf-8'
> ActionMailer::Base.smtp_settings = {
>   :enable_starttls_auto => true,
>   :address => "smtp.gmail.com",
>   :port => 587,
>   :domain => "gmail.com",
>   :authentication => :plain,
>   :user_name => "b...@gmail.com",
>   :password => "bla",
>   :default_content_type => "text/html"
>
> }
>
> I am composing email using tiny mce editor
> On sending it..
>
> I see it on gmail as
> lndglds
> sfglfs
>  
>
> instead of the html rendered.
>
> Does any one kno 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: Association extension method

2009-08-28 Thread David A. Black

Hi --

On Fri, 28 Aug 2009, Bryan Ash wrote:

>
> In my application a user working at a dropzone can manipulate
> transactions against customer accounts.  Here's my models:
>
> class Transaction < ActiveRecord::Base
>  belongs_to :account
> end
>
> class Account < ActiveRecord::Base
>  belongs_to :dropzone
>  has_many   :transactions
> end
>
> class Dropzone < ActiveRecord::Base
>  has_many :transactions, :through => :accounts do
>def limited_to(transaction)
>  scope = Transaction.scoped({ :conditions =>
> ['account.dropzone_id = ?', proxy_owner.id],

That should be accounts (plural) I suspect.


David

-- 
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Ruby/Rails training, mentoring, consulting, code-review
Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2)

September Ruby training in NJ has been POSTPONED. Details to follow.

--~--~-~--~~~---~--~~
You received 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: Time.today?

2009-08-28 Thread pharrington

On Aug 28, 4:56 pm, Fernando Perez 
wrote:
> Hi,
>
> Time.today fails on my server and works on my dev machine, both run
> Rails 2.3.3. What's going on?
> --
> Posted viahttp://www.ruby-forum.com/.

Whats are the respective Ruby versions? Time.today exists on 1.8.7,
but not 1.9.1 (or 1.8.6 to my knowledge)
--~--~-~--~~~---~--~~
You received 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: REPL in a browser.

2009-08-28 Thread pharrington

On Aug 28, 4:44 pm, chris_the_frog  wrote:
> Hi! I am a computer science student and I have a problem I just can't
> seem to find an answer to. I would like to embed a read-eval-print-
> loop in a website. Essentially, I'd like a window that mimics a
> console: the user types in some random text, it is processed, a value
> is returned and displayed, and then it waits for the user's input
> again*.  Exactly like a console.
>
> I am new to Ruby and I have only just begun looking at Rails. In fact,
> I have absolutely no experience in web programming whatever. So even
> if someone could just point me in the right direction, I'd appreciate
> it.
>
> * FYI, I am trying to create an online version of my research project:
> an interpreter and interactive environment for a small functional
> language.

I can't imagine Rails offering any aid in this endeavour; if you're
just taking user input to pass to a custom language interpreter, a
basic CGI script will do quite nicely (or maybe if you absolutely want
to get the lightweight stuff out of the way a much smaller framework
like Camping or Sinatra). Let me ask, do you already have your
language written? If so, I presume you used something other than Ruby,
so I'd probably be easiest to just write the web REPL in the used
language and pass the user's input as a string to to your interpreters
routines. Otherwise, using Ruby to call your language's interpreter
executable safely may prove difficult, as the easiest way to capture
output of an external command (backticks ` or %x{}) could make it
extremely difficult to sanitize input, and I know of no way to
redirect the output of the multi-argument version of Kernel#system
(which bypasses shell escaping). Eitherway, if anything malicious *is*
possible with your language, you'll first need to create a sandboxed
version of your interpreter before even considering building a web
frontend.

For just learning how to write a CGI script with Ruby though, the
standard documentation itself is quite explanatory (http://www.ruby-
doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI.html), and most frameworks
come with fantatsic documentation as well (hell, the text on www.sinatrarb.com
home page really is all you need for a working Sinatra app).
--~--~-~--~~~---~--~~
You received 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: plugin for running a timer based application

2009-08-28 Thread Franco Catena

Take a look at the Rufus Scheduler http://rufus.rubyforge.org/rufus-scheduler/

I hope this help you, regards.

Franco Catena.

On Aug 27, 4:59 pm, Rukku Bala 
wrote:
> Hi,
> I am trying to achieve the following.. wondering if there is any way to
> achieve this..
>
> Some background:
>
> 1. i have an application where the user can request an specific email to
> be sent at a scheduled time. For e.g. lets say user A wants is
> scheudling the email to be sent for 12:00pm. This is stored in a table
> called "send_notification" where the details is stored.
> 2. Another user B can login and schedule an notification say at 11:45am.
>
> Now, to achieve this..
> Option 1:
> If can have a background task that scans through this table and sends
> the notification. But if i write it as a task that wakes up every minute
> and send the notification, then it has to scan the whole table every
> time. Is it OK ?. In a scaled table it could be an issue.
> Opton 2:
> Maintain a "earliest time" variable in the application. Every time, a
> new notification is created, check if this time is earlier than the
> "earliest time". If so, then cancel the crontab and reschedule based on
> the "earliest time". If not, the crontab will expire and notification
> will be sent and scan the whole table and update the "earliest time".
> This again has the flaw of scanning the entire table.
>
> Option 3:
> an efficient option is to maintain a heap timer tree based on "shcedule
> time". Then the top node timer expires, the notification will be sent.
> This would require no scanning of table but maintaining the heap timer.
> Is a there a plugin for this ?.
>
> How does typcially achieve such a thing.
>
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] has HAML gone "mainstream"?

2009-08-28 Thread Jeff Pritchard

I've been looking for a new gig lately, and have noticed that an
alarming (to me, since I don't yet speak HAML) number of the openings
mention HAML as a required or desired skill.

I noticed HAML out of the corner of my eye back when it first came on
the scene, and at the time considered it to be not worth the effort to
learn yet another syntax.

It looks like maybe since that time it has become more common and gained
some traction.

What do you think?  Still just a "contender", or is it gaining
substantial "market share" and taking over the Rails universe?

thanks,
jp

(p.s. looks like maybe it goes hand in hand (expectation-wise) with
SASS, so comments on that welcome also)
-- 
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: has HAML gone "mainstream"?

2009-08-28 Thread pharrington

On Aug 28, 7:38 pm, Jeff Pritchard 
wrote:
> I've been looking for a new gig lately, and have noticed that an
> alarming (to me, since I don't yet speak HAML) number of the openings
> mention HAML as a required or desired skill.
>
> I noticed HAML out of the corner of my eye back when it first came on
> the scene, and at the time considered it to be not worth the effort to
> learn yet another syntax.
>
> It looks like maybe since that time it has become more common and gained
> some traction.
>
> What do you think?  Still just a "contender", or is it gaining
> substantial "market share" and taking over the Rails universe?
>
> thanks,
> jp
>
> (p.s. looks like maybe it goes hand in hand (expectation-wise) with
> SASS, so comments on that welcome also)
> --
> Posted viahttp://www.ruby-forum.com/.

I wouldn't really know, as the few gigs I've worked have all already
had ERB templates. I also tend to care very little about "market
share" or the next hot thing; if I have the choice and one tool is
easier/faster for a certain task than another (and yes, HAML is better
for producing HTML or XHTML markup than anything else right now), I'll
use the better tool.  However, HAML is **braindead simple** to learn
and become proficient with (really, http://haml-lang.com/tutorial.html
doesn't exaggerate at all about its simplicity), and since when was
learning more technologies ever a bad thing?
--~--~-~--~~~---~--~~
You received 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] Association extension method

2009-08-28 Thread Bryan Ash

In my application a user working at a dropzone can manipulate
transactions against customer accounts.  Here's my models:

class Transaction < ActiveRecord::Base
  belongs_to :account
end

class Account < ActiveRecord::Base
  belongs_to :dropzone
  has_many   :transactions
end

class Dropzone < ActiveRecord::Base
  has_many :transactions, :through => :accounts do
def limited_to(transaction)
  scope = Transaction.scoped({ :conditions =>
['account.dropzone_id = ?', proxy_owner.id],
   :joins  => :account })
  scope
end
  end
end

In a controller, I'd like to write:

current_dropzone.transactions.limited_to(@transaction)

but, I get the error:

  RuntimeError: ERROR   C42P01  Mmissing FROM-clause entry for
table "account"  P122Fparse_relation.c   L2017
RwarnAutoRange: SELECT "transactions".* FROM "transactions"   INNER
JOIN "accounts" ON "accounts".id = "transactions".account_id  WHERE
(account.dropzone_id = 2)  (ActionView::TemplateError)

I've searched all over and tried many options but can't figure this
out, I hope someone can help.

Many thanks,
Bryan
--~--~-~--~~~---~--~~
You received 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] Objects in Views

2009-08-28 Thread Dhruva Sagar
Hi everyone,

I have recently experienced a strange behavior (strange from my knowledge)
in rails.

In my controllers 'new' action, I am creating a few instance variables in
the following manner :

@controllerModel = ControllerModel.new
@model1 = Model1.all
@model2 = Model2.all

in my 'new' view, I am using the @controllerModel to create the form for new
and I am using the @model1 & @model2 within the form to populate 2 combo
boxes in the following manner :

f.select :model1_id, @model1.collect { |m1| [m1.name, m1.id] }

f.select :model2_id, @model2.collect { |m2| [m2.name, m2.id] }

Now everything works fine, the form is generated fine, there are no errors
even the form submit works fine when I ensure that all the required fields
(ControllerModel validations).

But in the event some of my validations fail and in the controller I
do a *render
:action => 'new'* I  am given an error / exception for @model1 & @model2
being nil. I don't understand the reason for the same, I am looking for an
explanation for this.

As a work around of course I found that if I add the following to the view
it works out fine, *but I don't understand the flow fully, I want to know
why the above mentioned error occurs*.

work around in 'new' view :

if @controllerModel.errors
@model1 = Model1.all
@model2 = Model2.all
end

Thanks & Regards,
Dhruva Sagar.


Stephen 
Leacock
- "I detest life-insurance agents: they always argue that I shall some
day
die, which is not so."

--~--~-~--~~~---~--~~
You received 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: 1 Form > 2 Models > 2nd Model Requres 1st Model ID

2009-08-28 Thread brianp

I can handle building two models from 1 form. It's getting the id from
the first saved model and inserting it in the second and rolling back
the whole transaction if anything goes wrong that is the problem.

On Aug 28, 9:43 am, Ar Chron  wrote:
> google "rails 1 form 2 models"
> --
> 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] Nil object nightmare

2009-08-28 Thread Anthony Gardner
I'm having a real problem with nil objects in a view I'm playing with.

if I type ...

<%= debug lesson.lesson_register.attendees %>

I get the following displayed in the browser 

- !ruby/object:Attendee
  attributes:
enrollee_id: "25"
created_at: 2009-08-27 15:10:41
updated_at: 2009-08-27 15:10:41
id: "1"
attended: f
lesson_register_id: "1"
  attributes_cache: {}

- !ruby/object:Attendee
  attributes:
enrollee_id: "26"
created_at: 2009-08-27 15:10:41
updated_at: 2009-08-27 15:10:41
id: "2"
attended: t
lesson_register_id: "1"


  attributes_cache: {}


if I type ...

<%= debug lesson.lesson_register.attendees[0] %>

I get correctly ...

--- !ruby/object:Attendee
attributes:
  enrollee_id: "25"
  created_at: 2009-08-27 15:10:41
  updated_at: 2009-08-27 15:10:41
  id: "1"
  attended: f
  lesson_register_id: "1"
attributes_cache: {}


BUT, when I type 

<%= debug lesson.lesson_register.attendees[0].created_at %>

I get 

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.created_at

Extracted source (around line *#7*):

7:   <%= debug lesson.lesson_register.attendees[0].created_at %>


Can someone tell me what I'm doing wrong.

TIA

-Ants


-- 
100% naturally selected. 0% designed.

--~--~-~--~~~---~--~~
You received 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 and Parallels running Vista?

2009-08-28 Thread elliottg

Parallels just blew up on me. Once I get it back online, I'll try what
you have recommended.


Thanks Frederick!

On Aug 28, 1:13 pm, Frederick Cheung 
wrote:
> On Aug 28, 5:56 pm, elliottg  wrote:
>
> > I have searched around a fair amount and I have yet to find any info
> > on getting Paralles to work with Passenger.
>
> > My dev box is running Leopard, then I have Parallels set up to run
> > Vista just for IE really. With Mongrel I could access it thru
> > Parallels at 192.168.1.100:3000 in IE.
>
> > For instance my vHost ServerName is testsite.local when I call that up
> > in Vista Parallels IE it doesn't work.
>
> have you edited windows' hosts file to tell it the ip address for
> testsite.local ?
>
> Fred
>
>
>
>
>
> > How would I get Parallels to work with Passenger?
>
> > Thanks a ton.
> > Elliott
--~--~-~--~~~---~--~~
You received 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: Error: uninitialized constant MysqlCompat::MysqlRes

2009-08-28 Thread Kyle Fox

To fix this, specify ARCHFLAGS when you install the 'mysql' gem:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-
config=/usr/local/mysql/bin/mysql_config

On Aug 27, 12:07 pm, Caleb Cullen 
wrote:
> Martin J. wrote:
> > Hi,
> > I installed the "kwatch-mysql-ruby" gem on my Debian server but when I
> > try to run the "db:migrate" task I get the following error:
>
> > ** Invoke db:migrate (first_time)
> > ** Invoke environment (first_time)
> > ** Execute environment
> > ** Execute db:migrate
> > rake aborted!
> > uninitialized constant MysqlCompat::MysqlRes
>
> I saw this, having freshly installed Rails 2.3.3, and then being told to
> run 'gem install mysql' because the MySQL client is no longer bundled
> with Rails, as of 2.2
>
> Okay, I did that.  Then I got the error message you showed in your post
> -- about MysqlCompat::MysqlRes not being defined.
>
> Turns out there is no such thing; this error is caused by a malfunction
> of the mysql-2.8.1 gem.
>
> If you install the gem by hand, chances are when you run the test you'll
> find that the gem's bundle doesn't actually manage to load the
> mysqlclient library.  (On my MacOS X 10.5.8 system, it's a .dylib; under
> Linux it may be a .so)
>
> The error message I saw during the test phase looked like this:
>
> ./mysql.bundle: dlopen(./mysql.bundle, 9): Library not loaded:
> /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib (LoadError)
>   Referenced from:
> /Users/ccullen/Projects/npapp-v2/mysql-ruby-2.8.1/mysql.bundle
>   Reason: image not found - ./mysql.bundle
>   from test.rb:5
>
> From that message you can see it's looking for the mysqlclient library
> in a directory one level too deep, vis-a-vis the location my libraries
> occupy:
> /usr/local/mysql/lib is right; /usr/local/mysql/lib/mysql is not.
>
> It is however pretty simple to create a 'mysql' symlink inside
> /usr/local/mysql/lib and point it at '.', allowing the broken
> mysql.bundle to locate its libraries.
>
> This is definitely a hack.  I just wanted to help, since I haven't seen
> any answers posted, and certainly nothing to explain why this error is
> occurring.
>
> Best of luck!
> --
> 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 and Parallels running Vista?

2009-08-28 Thread Hassan Schroeder

On Fri, Aug 28, 2009 at 9:56 AM, elliottg wrote:
>
> I have searched around a fair amount and I have yet to find any info
> on getting Paralles to work with Passenger.
>
> My dev box is running Leopard, then I have Parallels set up to run
> Vista just for IE really. With Mongrel I could access it thru
> Parallels at 192.168.1.100:3000 in IE.
>
> For instance my vHost ServerName is testsite.local when I call that up
> in Vista Parallels IE it doesn't work.
>
> How would I get Parallels to work with Passenger?

What does Passenger have to do with anything??

You could access your server by IP: 192.168.1.100 but you say you
*can't* access it via hostname: testsite.local

That means Vista is unable to resolve that hostname. Add your
server name to whatever hosts file Vista uses.

-- 
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: how to avoid (Net::SMTPFatalError) "555 5.5.2 Syntax error

2009-08-28 Thread Shan Huang

Thank you so much, I had the same problem and it worked.

On Jul 31, 2:26 pm, Chris Schumann 
wrote:
> Santosh Turamari wrote:
> >     @from = "#{sender}"
> > If I submit an email id, It is giving error as
> > (Net::SMTPFatalError) "555 5.5.2 Syntax error. d29sm1994943and.38\n"
>
> The from line is the problem. The Net::SMTP library was recently changed
> so it adds angle brackets to your sender, so you cannot have any in your
> string. Try this as a workaround:
>
>     @from = "a...@bbb.com"
> --
> 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] REPL in a browser.

2009-08-28 Thread chris_the_frog

Hi! I am a computer science student and I have a problem I just can't
seem to find an answer to. I would like to embed a read-eval-print-
loop in a website. Essentially, I'd like a window that mimics a
console: the user types in some random text, it is processed, a value
is returned and displayed, and then it waits for the user's input
again*.  Exactly like a console.

I am new to Ruby and I have only just begun looking at Rails. In fact,
I have absolutely no experience in web programming whatever. So even
if someone could just point me in the right direction, I'd appreciate
it.

* FYI, I am trying to create an online version of my research project:
an interpreter and interactive environment for a small functional
language.

--~--~-~--~~~---~--~~
You received 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: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread E. Litwin

Try extending  mysql_adapter.rb and add this method:

  def select_sp(sql, name = nil)
rows = select(sql, name = nil)
while (@connection.more_results?())
  @connection.next_result()
end
return rows
  end

Then call the SP using this method from your controller/model where
the sql param is: "call my_sp..."

On Aug 28, 1:10 am, Chris Dekker 
wrote:
> nas wrote:
> > Check this
>
> >http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails
>
> > On Aug 27, 3:09 pm, Chris Dekker 
>
> Thanks, but that link did not help me.
>
> For MYSQL it doesn't even work. Stored procedures are called through
> 'CALL', not 'EXECUTE'.
>
> Also as I wrote in my third post, I already get the stored procedure to
> execute, the problem seems to lie in the closing / freeing of the result
> set.
>
> Calling .free on the returned result set does not solve anything. Tested
> on both the latest 5.0 and 5.1 MySQL databases with the newest 2.8.1
> mysql gem
> --
> 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: Time.today?

2009-08-28 Thread Fernando Perez

> Are you sure you are not confusing it with Date.today?  I was not
> aware that there is a Time.today.  There is a Time.now.
> 
> Colin

On my dev Machine:

$ ./script/console
Loading development environment (Rails 2.3.3)
>> Time.now
=> Fri Aug 28 22:51:16 0200 2009
>> Time.today
=> Fri Aug 28 00:00:00 0200 2009

I do admit there is a problem with the time returned, but still the 
method call worked.
-- 
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: Time.today?

2009-08-28 Thread Colin Law

2009/8/28 Fernando Perez :
>
> Hi,
>
> Time.today fails on my server and works on my dev machine, both run
> Rails 2.3.3. What's going on?

Are you sure you are not confusing it with Date.today?  I was not
aware that there is a Time.today.  There is a Time.now.

Colin

--~--~-~--~~~---~--~~
You received 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 error NoMethodError in Book#new

2009-08-28 Thread deostroll

Okay don't worry I got that...and its fixed.

On Aug 28, 9:55 pm, deostroll  wrote:
> > > Have you run all the necessary database migrations?  Does the books
> > > table have the title and price columns?
>
> I started all over. When I run the rake db:migrate I get this error:
>
> $rake db:migrate
> (in /home/deostroll/Desktop/sites/library)
> == 20090828225043 Books: migrating
> 
> -- t()
> rake aborted!
> undefined method `t' for
> #
>
> (See full trace by running task with --trace)
>
> I don't understand this error?
--~--~-~--~~~---~--~~
You received 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] Time.today?

2009-08-28 Thread Fernando Perez

Hi,

Time.today fails on my server and works on my dev machine, both run
Rails 2.3.3. What's going on?
-- 
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: Passenger and Parallels running Vista?

2009-08-28 Thread Frederick Cheung



On Aug 28, 5:56 pm, elliottg  wrote:
> I have searched around a fair amount and I have yet to find any info
> on getting Paralles to work with Passenger.
>
> My dev box is running Leopard, then I have Parallels set up to run
> Vista just for IE really. With Mongrel I could access it thru
> Parallels at 192.168.1.100:3000 in IE.
>
> For instance my vHost ServerName is testsite.local when I call that up
> in Vista Parallels IE it doesn't work.

have you edited windows' hosts file to tell it the ip address for
testsite.local ?

Fred
>
> How would I get Parallels to work with Passenger?
>
> Thanks a ton.
> Elliott
--~--~-~--~~~---~--~~
You received 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: Finding data which, when tweaked, matches.

2009-08-28 Thread Aldric Giacomoni

Rick Lloyd wrote:
> SQL provides a LIKE function for simple pattern matching.  Also, both
> mySql and PostgreSql provide REGEX functions though they may not be
> identical in use.
> 

So are you suggesting that I do something like this:

string = params[:social]
# magic on string until string = "%0%1%2%3%4%5%6%7%8%" ?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+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] Error connecting to Sybase (odd)

2009-08-28 Thread Aldric Giacomoni

I have activerecord-sybase-adapter installed -- and Sybase itself, so I
have the drivers.

In irb or in the rails console, this works:

ActiveRecord::Base.establish_connection(
:adapter => “sybase”,
:database => “mydb”,
:host => “myhost”,
:myport => myport,
:username => “read_only”,
:password => “read_only”)

In Rails, I have this in my database.yml:
pacs:
  adapter: sybase
  database: mydb
  username: read_only
  password: read_only
  host: myhost
  port: myport

And then I have the following model:
class PacsPatient < ActiveRecord::Base

  establish_connection "pacs"
  set_table_name "patient"
  set_primary_key "pat_ckey"

end

So, when I go to the console and try to do something like..
>> PacsPatient.find 1

#: connect failed
from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in
`connect'
from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in
`open'
from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybsql.rb:269:in
`initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sybase-adapter-1.0.0.9250/lib/active_record/connection_adapters/sybase_adapter.rb:46:in
`new'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sybase-adapter-1.0.0.9250/lib/active_record/connection_adapters/sybase_adapter.rb:46:in
`sybase_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
from c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
`retrieve_connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in
`connection'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3103:in
`quoted_table_name'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1583:in
`find_one'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1574:in
`find_from_ids'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:616:in
`find'
from (irb):1>>


So it seems that I'm doing something wrong.. But what?
-- 
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: *Please Help* Cannot save a new user to the database...

2009-08-28 Thread Colin Law

2009/8/28 RubyonRails_newbie :
>
> ... the strange thing is, the code I have written is axactly the same
> as that in the railsspace website
> (http://railsspace.com/4_register/listing-4-20.txt)

Could you bottom post rather than top? That is the convention on this
list, it makes it easier to follow threads.

Do they go on to extend this code to cope with save failures later on
in the tutorial?  If you just want to get past this for the moment
have a close look at any validations in the User model, possibly
comment them out for the moment.  Also have a look at the log
(log/development.log) to see what values were passed as params in the
POST.  This may be a good time to have a look at ruby-debug (see
http://railscasts.com/episodes/54-debugging-with-ruby-debug). You
could put a break point after @user = User.new(params[:user]) and
check that it looks ok.

Colin


> On 28 Aug, 14:33, RubyonRails_newbie 
> wrote:
>> cheers Colin - i'll try this out.
>>
>> On 28 Aug, 14:26, Colin Law  wrote:
>>
>>
>>
>> > 2009/8/28 RubyonRails_newbie :
>>
>> > > Hello,
>>
>> > > I am following the RailsSpace tutorial and am at the point where I am
>> > > creating a new user through (user/register)
>>
>> > > I have added the details into the form: screen_name, email and
>> > > password.
>>
>> > > When I click register, I would expect this to be saved (commited) to
>> > > the database.
>>
>> > > However – when I look in the terminal, it says ‘Rollback’ instead of
>> > > ‘COMMIT’
>>
>> > > The code in the user controller looks like this:
>>
>> > > class UserController < ApplicationController
>>
>> > >  def register
>> > >   �...@title = "Register"
>> > >    if request.post? and params[:user]
>> > >     �...@user = User.new(params[:user])
>> > >      if @user.save
>> > >        flash[:notice] = "User #...@user.screen_name} created!"
>> > >        redirect_to :action => "index"
>>
>> > I would expect see something like this here, for the case when the save 
>> > fails
>> >        else
>> >          render :action => "new or whatever is is the action that
>> > posted to register"
>>
>> > >      end
>> > >    end
>> > >  end
>>
>> > > Does anyone know why in my terminal it is not saving this as I’d
>> > > expect?
>>
>> > Maybe your validations are failing, if you have the else condition
>> > above and then in the new action (or whatever it is) inside the
>> > form_for you should have <%= f.error_messages %> and the errors will
>> > appear.
>>
>> > Colin- Hide quoted text -
>>
>> > - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
> >
>

--~--~-~--~~~---~--~~
You received 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: Routes problem

2009-08-28 Thread E. Litwin

Another tip is to run "rake routes" to see all the available routes.

On Aug 28, 9:26 am, James Englert  wrote:
> ROR will attempt to find routes from the top of the file first and then move
> on to the rest of the file. It would seem that you have listed projects
> twice:
>
> map.resources :*projects*, :departments, :users, :admins, :imports, :notes
>
> #Below is route in question
> map.resources :*projects*, :collection => { :view_all => :get }
>
> The first one (without the :collection) would be used.
>
> Hope this helps.
>
> On Fri, Aug 28, 2009 at 11:34 AM, John Mcleod <
>
> rails-mailing-l...@andreas-s.net> wrote:
>
> > Hello all,
> > Here's a newbie question (4 weeks and counting).
> > My routes.rb is as below.
>
> > map.resources :projects, :departments, :users, :admins, :imports, :notes
>
> > #Below is route in question
> > map.resources :projects, :collection => { :view_all => :get }
>
> > map.home '', :controller => 'projects', :action => 'index'
> > map.connect ':controller/:action/:id.:format'
> > map.connect ':controller/:action/:id'
>
> > I'm tried to get a url like this:
> >http://localhost:3000/projects/view_all
>
> > I have a view_all in the ProjectsController and I have a view_all
> > template.
>
> > When I type in the desired url, I get this error:
>
> > "ActiveRecord::RecordNotFound in ProjectsController#show
>
> > Couldn't find Project with ID=view_all"
>
> > Thank you for any help.
>
> > JohnM
> > --
> > 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] Cucmber

2009-08-28 Thread Douglas Elliott

A client of mine located in Atlanta is looking for a strong Business
Analyst with knowledge of Ruby on Rails and Cucumber. This would be a
Full Time position and they would pay relocation.

I am not proficient in Cucumber so I cannot do this job but I figured
someone here might.

If anyone is interested please contact me at d...@presalesus.com

Best,
Douglas
-- 
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] new Ajax.Request + :complete => + javascript

2009-08-28 Thread Abhishek shukla
Hello friends
Action i am making a ajax request from a javascript function and i want to
have a spinner ::complete =>  "Element.hide('spinner');", But not able to
insert it,
Is there any one who have an idea?

Thanks
Abhis

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



[Rails] Re: getting error NoMethodError in Book#new

2009-08-28 Thread deostroll

> > Have you run all the necessary database migrations?  Does the books
> > table have the title and price columns?

I started all over. When I run the rake db:migrate I get this error:

$rake db:migrate
(in /home/deostroll/Desktop/sites/library)
== 20090828225043 Books: migrating

-- t()
rake aborted!
undefined method `t' for
#

(See full trace by running task with --trace)


I don't understand this error?
--~--~-~--~~~---~--~~
You received 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: instance variables added in rails helpers are not available

2009-08-28 Thread Saty Nos

Frederick Cheung wrote:
> On Aug 28, 3:11�pm, Saty Nos  wrote:
> 
>> <%= title %>
>>
>> it is showing as '' and after some debugging, looks like @title is not
>> being set.
>>
>> Why are the instance variables added in the helpers not available in the
>> views (templates)?
> 
> because you didn;t create an instance variable. you just created a
> local variable called title (your title= method was never called)
> 
> Fred

thanks fred, using self.title = 'some title' solved the problem
-- 
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] Passenger and Parallels running Vista?

2009-08-28 Thread elliottg

I have searched around a fair amount and I have yet to find any info
on getting Paralles to work with Passenger.

My dev box is running Leopard, then I have Parallels set up to run
Vista just for IE really. With Mongrel I could access it thru
Parallels at 192.168.1.100:3000 in IE.

For instance my vHost ServerName is testsite.local when I call that up
in Vista Parallels IE it doesn't work.

How would I get Parallels to work with Passenger?

Thanks a ton.
Elliott
--~--~-~--~~~---~--~~
You received 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 redrawing

2009-08-28 Thread RVince

Colin,

I think what I am asking is, should a redraw of a partial be the
equivalent of a refresh of that partial only? (and if so, would that
hold for a partial in a partial, or is that considered bad form in the
rails world?) -RVince

On Aug 28, 10:56 am, Colin Law  wrote:
> 2009/8/28 RVince :
>
>
>
> > I have a select in a partial (_partialInPartial) , which itself is in
> > a partial (_partial).
>
> > _partialInPartial contains a select. WIthin the select, I
> > have :selected = > nil so that there is nothing selected. When I
> > redraw it, I therefore expect that nothing will be selected in it.
>
> > However, when I render :partial => '_partialInPartial' it is still
> > retaining the previously selected value
>
> When you say 'redraw' do you mean go back to it in the browser or is
> it a fresh render from the server.  If the former then it is the
> browser keeping the previous selection not your application.  View the
> source in the browser to see if your selected => nil is getting
> through correctly.
>
> Colin
>
>
>
> > Is this because it is a partial within a partial? If so, how can I get
> > around this to make certaian a select in  a partial is always set to,
> > in effect, un-selected? Thanks, RVince
--~--~-~--~~~---~--~~
You received 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: Routes problem

2009-08-28 Thread Ar Chron

John Mcleod wrote:
> Hello all,
> Here's a newbie question (4 weeks and counting).
> My routes.rb is as below.
> 
> map.resources :projects, :departments, :users, :admins, :imports, :notes
> 
> #Below is route in question
> map.resources :projects, :collection => { :view_all => :get }
> 
> map.home '', :controller => 'projects', :action => 'index'
> map.connect ':controller/:action/:id.:format'
> map.connect ':controller/:action/:id'
> 
> I'm tried to get a url like this:
> http://localhost:3000/projects/view_all
> 
> I have a view_all in the ProjectsController and I have a view_all
> template.
> 
> When I type in the desired url, I get this error:
> 
> "ActiveRecord::RecordNotFound in ProjectsController#show
> 
> Couldn't find Project with ID=view_all"
> 
> Thank you for any help.
> 
> JohnM

Your view_all == default index

That being said, when you add a controller method like view_all, you'll 
need to tell the routes about it (add view_all as a get method for the 
collection)

map.resources :projects, :collection => {:view_all => :get}
-- 
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: Finding data which, when tweaked, matches.

2009-08-28 Thread Rick

Not quite, in PostgreSql you could use

SELECT * FROM tablename WHERE fieldname SIMILAR TO '[-a-z]*0[-a-z]*1[-
a-z]*2[-a-z]*3[-a-z]*4[-a-z]*5[-a-z]*6[-a-z]*7[-a-z]*8[-a-z]*'

to push all the filtering into the query.

On Aug 28, 11:57 am, Aldric Giacomoni  wrote:
> Rick Lloyd wrote:
> > SQL provides a LIKE function for simple pattern matching.  Also, both
> > mySql and PostgreSql provide REGEX functions though they may not be
> > identical in use.
>
> So are you suggesting that I do something like this:
>
> string = params[:social]
> # magic on string until string = "%0%1%2%3%4%5%6%7%8%" ?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rake db:test:clone_structure and related tasks fail

2009-08-28 Thread Thomas Allen

It appears that this is coming from my installed lib/mysql_adapter.rb
which has an incorrect signature for recreate_database (and probably
for other methods as well), so I think I have what I need to solve the
problem now.

Thomas

On Aug 28, 9:50 am, Thomas Allen  wrote:
> On Aug 28, 3:23 am, Nik Cool  wrote:
>
> > > rake aborted!
> > > wrong number of arguments (2 for 1)
> > > /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:
> > > 344:in `recreate_database'
>
> > > Thanks!
> > > Thomas
>
> > do you have test database created ?
> > --
> > Posted viahttp://www.ruby-forum.com/.
>
> Yep, I do. I tried it with the MySQL test db initially (user: test,
> pw: "") and that failed with the same error. I'm able to connect to
> either database both via the MySQL client and Ruby.
>
> Thomas
--~--~-~--~~~---~--~~
You received 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: Routes problem

2009-08-28 Thread James Englert
ROR will attempt to find routes from the top of the file first and then move
on to the rest of the file. It would seem that you have listed projects
twice:

map.resources :*projects*, :departments, :users, :admins, :imports, :notes

#Below is route in question
map.resources :*projects*, :collection => { :view_all => :get }

The first one (without the :collection) would be used.

Hope this helps.

On Fri, Aug 28, 2009 at 11:34 AM, John Mcleod <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hello all,
> Here's a newbie question (4 weeks and counting).
> My routes.rb is as below.
>
> map.resources :projects, :departments, :users, :admins, :imports, :notes
>
> #Below is route in question
> map.resources :projects, :collection => { :view_all => :get }
>
> map.home '', :controller => 'projects', :action => 'index'
> map.connect ':controller/:action/:id.:format'
> map.connect ':controller/:action/:id'
>
> I'm tried to get a url like this:
> http://localhost:3000/projects/view_all
>
> I have a view_all in the ProjectsController and I have a view_all
> template.
>
> When I type in the desired url, I get this error:
>
> "ActiveRecord::RecordNotFound in ProjectsController#show
>
> Couldn't find Project with ID=view_all"
>
> Thank you for any help.
>
> JohnM
> --
> 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: 1 Form > 2 Models > 2nd Model Requres 1st Model ID

2009-08-28 Thread Ar Chron

google "rails 1 form 2 models"
-- 
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: Routes problem

2009-08-28 Thread Ar Chron

John Mcleod wrote:
> Since I've been learning rails, I thought that routes are the linking of 
> the "Controller" Object to their "Action" method.
> When you set up RESTful routing, you need to add custom or named routes 
> after the default 7.

I tend to think of it as adding them 'inline'

As Rob suggested:

>> Combine those into:

map.resources :projects, :collection => { :view_all => :get }

The above line gets you the default routes, and adds a route that works 
on the projects collection called 'view_all' and is a GET request.  Just 
what your view_all route will do is up to the controller code for that 
method, but we assumed that you're returning all the projects, which is 
what 'index' does.
Hence my earlier point that your 'show_all' is functionally the same as 
the default 'index', and unnecessary...

There is also the ability to add routes that deal with a specific 
project.  You'd specify this type of route using the :member 
specification.

map.resources :projects, :member => {:as_pdf => :get}

This route is intended to operate against a single project, and is a GET 
request.

My app has a project model as well, and it's map.resources line looks 
like this:
map.resources :projects, :member => {:as_pdf => :get, :clone => :get, 
:trace => :get}

This yields the index, show, new, create, edit, update, and destroy 
standard routes, as well as:
an 'as_pdf' route (to generate a pdf of the project info),
a 'clone' route (makes a deep clone of an existing project), and
a 'trace' route which generates a traceability view of the project)

Run a rake routes >routes.lst command from the root of your app, then 
look insude routes.lst to see what's being generated for you by restful 
routing. It's very informative.

-- 
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] get this error: "A copy of * has been removed from the module tree but is still active!"

2009-08-28 Thread mano

Hi,

In one of my javascript functions I do two consecutive GET (ajax)
requests in quick succession. I get the following error in Rails
version 2.3.3 but not in 2.3.2. If I give a time lag (even 500ms)
between to two requests the problem vanishes!!:


 ArgumentError

in StudentsController#index

A copy of StudentsController has been removed from the module
tree but is still active!

Sometimes I also get 'A copy of AuthenticatedSystem has been removed
from the module tree but is still active!' error.

Someone else has also been having a similar problem (http://
railsforum.com/viewtopic.php?id=33976)

The application trace is:


  /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/
active_support/dependencies.rb:414:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/
dependencies.rb:96:in `const_missing'
/home/~/app/controllers/students_controller.rb:4:in `index'



  /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/
active_support/dependencies.rb:414:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/
dependencies.rb:96:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:1327:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:1327:in `perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
filters.rb:617:in `call_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
filters.rb:610:in `perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/
core_ext/benchmark.rb:17:in `ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/
core_ext/benchmark.rb:17:in `ms'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
rescue.rb:160:in `perform_action_without_flash'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
flash.rb:146:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:527:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:527:in `process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
filters.rb:606:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:391:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
base.rb:386:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
routing/route_set.rb:434:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
dispatcher.rb:88:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
dispatcher.rb:111:in `_call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
dispatcher.rb:82:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
query_cache.rb:29:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
query_cache.rb:29:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
connection_adapters/abstract/query_cache.rb:34:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
query_cache.rb:9:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
query_cache.rb:28:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/
connection_adapters/abstract/connection_pool.rb:361:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:
24:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
params_parser.rb:15:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
session/cookie_store.rb:93:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
reloader.rb:29:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
failsafe.rb:26:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/
dispatcher.rb:106:in `call'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/rails/rack/static.rb:31:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `each'
/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `call'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/

[Rails] Re: Routes problem

2009-08-28 Thread Himanshu Prakash
Hi John,
try this approach:
in the Product class add this function-

require 'uri'
  def self.find_custom arg
object = self.new
object.id = URI.escape(arg)
object
  end

and in the controller try calling as:
Product.find_custom(params[:id]).view_all

just try it, and let me know.

On Fri, Aug 28, 2009 at 9:04 PM, John Mcleod <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hello all,
> Here's a newbie question (4 weeks and counting).
> My routes.rb is as below.
>
> map.resources :projects, :departments, :users, :admins, :imports, :notes
>
> #Below is route in question
> map.resources :projects, :collection => { :view_all => :get }
>
> map.home '', :controller => 'projects', :action => 'index'
> map.connect ':controller/:action/:id.:format'
> map.connect ':controller/:action/:id'
>
> I'm tried to get a url like this:
> http://localhost:3000/projects/view_all
>
> I have a view_all in the ProjectsController and I have a view_all
> template.
>
> When I type in the desired url, I get this error:
>
> "ActiveRecord::RecordNotFound in ProjectsController#show
>
> Couldn't find Project with ID=view_all"
>
> Thank you for any help.
>
> JohnM
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
Regards,
Himanshu

--~--~-~--~~~---~--~~
You received 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: InvalidAuthenticityToken

2009-08-28 Thread Philip Hallstrom

> What does the below line says
>
> ActionController::InvalidAuthenticityToken
> (ActionController::InvalidAuthenticityToken):
>  -e:2:in `load'
>  -e:2

Rails tries to protect against invalid form submission by setting an  
authenticity token.  It does this automatically if you use the form  
helpers, but if you hard code a form or it's doing something odd  
(built with javascript, cached and displayed on multiple pages, etc..)  
the token won't get sent.

Go look at a normal rails form and you'll see a hidden field in the  
form "authenticity_token".

You can tell your controller to ignore it or you can add it yourself.

http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html#M000512

For example in one of my forms built from jss and using ajax I pass  
this along...

  submitdata: {<%= request_forgery_protection_token.to_s %>: '<%=  
form_authenticity_token.to_s %>'}

In another form which doesn't use the Rails helpers so doesn't get the  
token set automatically I simply include this b/n my form tags:

<%= token_tag %>

Good luck!

-philip

--~--~-~--~~~---~--~~
You received 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: Routes problem

2009-08-28 Thread John Mcleod

Since I've been learning rails, I thought that routes are the linking of 
the "Controller" Object to their "Action" method.
When you set up RESTful routing, you need to add custom or named routes 
after the default 7.
To set up custom or named routes, you use "map.connect" "path/to/view", 
:controller => 'controller', :aciton => 'action'

Is this correct or am I lost?

Rob Biedenharn wrote:
> On Aug 28, 2009, at 11:34 AM, John Mcleod wrote:
>> Hello all,
>> Here's a newbie question (4 weeks and counting).
>> My routes.rb is as below.
>>
>> map
>> .resources :projects, :departments, :users, :admins, :imports, :notes
>>
>> #Below is route in question
>> map.resources :projects, :collection => { :view_all => :get }
> 
> Routes have preference based on their order of appearance. The first
> time you create routes for :projects, there's a show route like /
> projects/:id and that matches before the second one.
> 
> Combine those into:
> 
> map.resources :projects, :collection => { :view_all => :get }
> map.resources :departments, :users, :admins, :imports, :notes
> 
> HOWEVER, the regular route:
>   /projects
> is normally going to show you all the projects anyway.
> 
> -Rob
> 
> Rob Biedenharnhttp://agileconsultingllc.com
> r...@agileconsultingllc.com

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

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



[Rails] default_scope and scoped_methods in 2.2.2 ?

2009-08-28 Thread throwern

I am running rails 2.2.2 and cannot upgrade to 2.3 at this time.

However, I would like to use a default_scope and so I have installed
the default_scope plugin.
This works great for standard AR classes but does not carry through
Single Table Inheritance without adding the default_scope declaration
to every class. Not very DRY

I was hoping someone could shed some light on the following
undocumented ActiveRecord method.

def scoped_methods #:nodoc:
   Thread.current[:"#{self}_scoped_methods"] ||= []
end

I am hoping I can make the following change without breaking anything.

def scoped_methods #:nodoc:
  Thread.current[:"#{self.base_class}_scoped_methods"] ||= []
end




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



[Rails] Re: Routes problem

2009-08-28 Thread Rob Biedenharn

On Aug 28, 2009, at 11:34 AM, John Mcleod wrote:
> Hello all,
> Here's a newbie question (4 weeks and counting).
> My routes.rb is as below.
>
> map
> .resources :projects, :departments, :users, :admins, :imports, :notes
>
> #Below is route in question
> map.resources :projects, :collection => { :view_all => :get }

Routes have preference based on their order of appearance. The first  
time you create routes for :projects, there's a show route like / 
projects/:id and that matches before the second one.

Combine those into:

map.resources :projects, :collection => { :view_all => :get }
map.resources :departments, :users, :admins, :imports, :notes

HOWEVER, the regular route:
/projects
is normally going to show you all the projects anyway.

-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com


>
> map.home '', :controller => 'projects', :action => 'index'
> map.connect ':controller/:action/:id.:format'
> map.connect ':controller/:action/:id'
>
> I'm tried to get a url like this:
> http://localhost:3000/projects/view_all
>
> I have a view_all in the ProjectsController and I have a view_all
> template.
>
> When I type in the desired url, I get this error:
>
> "ActiveRecord::RecordNotFound in ProjectsController#show
>
> Couldn't find Project with ID=view_all"
>
> Thank you for any help.
>
> JohnM
> -- 
>



--~--~-~--~~~---~--~~
You received 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] emails - html not rendering

2009-08-28 Thread Ritvvij

Hi,

i am using ruby 1.8.7 and rails 2.3.3
i can send emails using gmail smtp
my config is:

ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_charset = 'utf-8'
ActionMailer::Base.smtp_settings = {
  :enable_starttls_auto => true,
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "gmail.com",
  :authentication => :plain,
  :user_name => "b...@gmail.com",
  :password => "bla",
  :default_content_type => "text/html"
}

I am composing email using tiny mce editor
On sending it..

I see it on gmail as
lndglds
sfglfs
 

instead of the html rendered.

Does any one kno 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] Routes problem

2009-08-28 Thread John Mcleod

Hello all,
Here's a newbie question (4 weeks and counting).
My routes.rb is as below.

map.resources :projects, :departments, :users, :admins, :imports, :notes

#Below is route in question
map.resources :projects, :collection => { :view_all => :get }

map.home '', :controller => 'projects', :action => 'index'
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'

I'm tried to get a url like this:
http://localhost:3000/projects/view_all

I have a view_all in the ProjectsController and I have a view_all
template.

When I type in the desired url, I get this error:

"ActiveRecord::RecordNotFound in ProjectsController#show

Couldn't find Project with ID=view_all"

Thank you for any help.

JohnM
-- 
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: First App- Error 500

2009-08-28 Thread Aldric Giacomoni

He is running on Windows.
I had to put sqlite3.dll and tclsqlite3.dll in my c:\ruby\bin directory.
See if that fixes it.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: *Please Help* Cannot save a new user to the database...

2009-08-28 Thread Hassan Schroeder

On Fri, Aug 28, 2009 at 5:20 AM,
RubyonRails_newbie wrote:

> I have added the details into the form: screen_name, email and
> password.
>
> When I click register, I would expect this to be saved (commited) to
> the database.

And there's no specific error in the log? That's surprising.

I would try this in the Rails console, using  @user.save! to show any
errors being generated.

You could also look at your DB query and/or error logs for more info.

-- 
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] Simple question about collections

2009-08-28 Thread Aldric Giacomoni

Alright, so.. Let's try this:
1) I have a view which one way or another calls a controller action and
wants to update a div.
2) This controller action finds a collection of records and does a
render :partial with said collection
(e.g. : @patients with Patient.last and Patient.first)

3) ... What's the partial going to look like? This is where I don't
understand how to use collections.

If I do a ":collection => " call, what exactly am I asking Rails to do..
And then how do I help it do that?
-- 
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 redrawing

2009-08-28 Thread Colin Law

2009/8/28 RVince :
>
> I have a select in a partial (_partialInPartial) , which itself is in
> a partial (_partial).
>
> _partialInPartial contains a select. WIthin the select, I
> have :selected = > nil so that there is nothing selected. When I
> redraw it, I therefore expect that nothing will be selected in it.
>
> However, when I render :partial => '_partialInPartial' it is still
> retaining the previously selected value

When you say 'redraw' do you mean go back to it in the browser or is
it a fresh render from the server.  If the former then it is the
browser keeping the previous selection not your application.  View the
source in the browser to see if your selected => nil is getting
through correctly.

Colin

>
> Is this because it is a partial within a partial? If so, how can I get
> around this to make certaian a select in  a partial is always set to,
> in effect, un-selected? Thanks, RVince
> >
>

--~--~-~--~~~---~--~~
You received 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] Finding data which, when tweaked, matches.

2009-08-28 Thread Aldric Giacomoni

Say I have a string : "012345678".
I have a column in a table which also stores strings. I want to find all
rows which match that string of numbers in that order.
That is, "012345678" will match, but "012-34-5678" will, and
"012sneeze345bless67you8thanks" also will.

Do I have to do something like:
ThisIsMyString = "012345678"
fits = Patient.all.find { |a| a.identifier.delete("^[0-9]") ==
ThisIsMyString }

.. Or can I do something WITHOUT getting all the data, a kind of
Patient.find but with a tweak on the sql query?
-- 
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: *Please Help* Cannot save a new user to the database...

2009-08-28 Thread RubyonRails_newbie

... the strange thing is, the code I have written is axactly the same
as that in the railsspace website
(http://railsspace.com/4_register/listing-4-20.txt)


On 28 Aug, 14:33, RubyonRails_newbie 
wrote:
> cheers Colin - i'll try this out.
>
> On 28 Aug, 14:26, Colin Law  wrote:
>
>
>
> > 2009/8/28 RubyonRails_newbie :
>
> > > Hello,
>
> > > I am following the RailsSpace tutorial and am at the point where I am
> > > creating a new user through (user/register)
>
> > > I have added the details into the form: screen_name, email and
> > > password.
>
> > > When I click register, I would expect this to be saved (commited) to
> > > the database.
>
> > > However – when I look in the terminal, it says ‘Rollback’ instead of
> > > ‘COMMIT’
>
> > > The code in the user controller looks like this:
>
> > > class UserController < ApplicationController
>
> > >  def register
> > >   �...@title = "Register"
> > >    if request.post? and params[:user]
> > >     �...@user = User.new(params[:user])
> > >      if @user.save
> > >        flash[:notice] = "User #...@user.screen_name} created!"
> > >        redirect_to :action => "index"
>
> > I would expect see something like this here, for the case when the save 
> > fails
> >        else
> >          render :action => "new or whatever is is the action that
> > posted to register"
>
> > >      end
> > >    end
> > >  end
>
> > > Does anyone know why in my terminal it is not saving this as I’d
> > > expect?
>
> > Maybe your validations are failing, if you have the else condition
> > above and then in the new action (or whatever it is) inside the
> > form_for you should have <%= f.error_messages %> and the errors will
> > appear.
>
> > Colin- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received 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: Finding data which, when tweaked, matches.

2009-08-28 Thread Rick

SQL provides a LIKE function for simple pattern matching.  Also, both
mySql and PostgreSql provide REGEX functions though they may not be
identical in use.

On Aug 28, 10:30 am, Aldric Giacomoni  wrote:
> Say I have a string : "012345678".
> I have a column in a table which also stores strings. I want to find all
> rows which match that string of numbers in that order.
> That is, "012345678" will match, but "012-34-5678" will, and
> "012sneeze345bless67you8thanks" also will.
>
> Do I have to do something like:
> ThisIsMyString = "012345678"
> fits = Patient.all.find { |a| a.identifier.delete("^[0-9]") ==
> ThisIsMyString }
>
> .. Or can I do something WITHOUT getting all the data, a kind of
> Patient.find but with a tweak on the sql query?
> --
> 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] instance variables added in rails helpers are not available

2009-08-28 Thread Saty Nos



I am trying to add some instance variables in helpers like the
following:

module ApplicationHelper
 def title=(title)
   @title = title
 end

 def title
  @title
 end
end

and when I assign title in views/pages/index.html.erb like the
following:

<% title = 'Listing Pages' %>

and try to show it in the views/layouts/application.html.erb like the
following:

<%= title %>

it is showing as '' and after some debugging, looks like @title is not
being set.

Why are the instance variables added in the helpers not available in the
views (templates)?

Thanks in advance.
-- 
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: rake db:test:clone_structure and related tasks fail

2009-08-28 Thread Thomas Allen

On Aug 28, 3:23 am, Nik Cool  wrote:
> > rake aborted!
> > wrong number of arguments (2 for 1)
> > /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:
> > 344:in `recreate_database'
>
> > Thanks!
> > Thomas
>
> do you have test database created ?
> --
> Posted viahttp://www.ruby-forum.com/.

Yep, I do. I tried it with the MySQL test db initially (user: test,
pw: "") and that failed with the same error. I'm able to connect to
either database both via the MySQL client and Ruby.

Thomas


--~--~-~--~~~---~--~~
You received 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: A resource named "image" gives problems

2009-08-28 Thread Alpha Blue

map.resources :images, :as => 'your_custom_name'

You've already read the API about the ActionView helpers so you know 
it's not something you can use.

You can post suggestions in Dev but the likelihood of this being changed 
is nil.
-- 
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: Sum won't seem to add the fields?!

2009-08-28 Thread mvp

Hi,

I have pasted a simplified version of the problem you are trying to
understand. You cannot do a 'sum' on a collection that has a 'nil' as
one of its elements. If 'nil' happens to be the first element, you
will get the 'NoMethodError' , as the method '+' is called on it (as
shown in the error trace 'nil.+') . Also note that the elements of the
collection have to define the method '+' for sum to work.

'sum' works by using 'inject' which in turn takes the first element
(unless an initial value is provided) and calls + on it using the next
element in collection as the input, then takes the result and repeats
the process for all the rest of the elements

>> ar = [1,2,3]
=> [1, 2, 3]
>> ar.sum
=> 6
>> ar = [nil,2,3]
=> [nil, 2, 3]
>> ar.sum
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/
active_support/core_ext/enumerable.rb:63:in `sum'
from (irb):16:in `inject'
...
>>

regards,
mvp

On Aug 26, 10:00 pm, "Ruby on Rails: Talk" 
wrote:
> I have the code which creates the following made up of an array of 3
> TreatLists each with a number of Treatlistitems (I've broken it up to
> make it easier to read).
>
> ?> @breakdown
> => [
> # # @prodtreat="T", @numsold=2, @unitcost=10.0>]>,
>
> # @items=[# @spend=10.0, @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @spend=10.0, @prodtreat="T", @numsold=1, @unitcost=10.0>]>,
>
> # # @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @prodtreat="T", @numsold=2, @unitcost=10.0>,
> # @prodtreat="T", @numsold=1, @unitcost=10.0>,
> # @prodtreat="P", @numsold=1, @unitcost=10.0>]>]
>
> I'm trying to add together the 'spend' figures from each but only if
> prodtreat = T or P. When I try the following:
>
> >> @breakdown[1].items.sum{|item| item.spend if item.prodtreat == "T"}
>
> => 30.0
>
> it works!!!
>
> But when I try it with P ...
>
> >> @breakdown[1].items.sum{|item| item.spend if item.prodtreat == "P"}
>
> I get the following:
>
> NoMethodError: You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.+
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/
> active_support/core_ext/enumerable.rb:63:in `sum'
>         from (irb):65:in `inject'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/
> active_support/core_ext/enumerable.rb:63:in `each'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/
> active_support/core_ext/enumerable.rb:63:in `inject'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/
> active_support/core_ext/enumerable.rb:63:in `sum'
>         from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/
> active_support/core_ext/enumerable.rb:61:in `sum'
>         from (irb):65
>
>
>
> I really have no idea why this is not working or not returning a zero
> value?! Any ideas please?
>
> Cheers
>
> Darren

--~--~-~--~~~---~--~~
You received 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: instance variables added in rails helpers are not available

2009-08-28 Thread Frederick Cheung



On Aug 28, 3:11 pm, Saty Nos  wrote:

> <%= title %>
>
> it is showing as '' and after some debugging, looks like @title is not
> being set.
>
> Why are the instance variables added in the helpers not available in the
> views (templates)?

because you didn;t create an instance variable. you just created a
local variable called title (your title= method was never called)

Fred
>
> Thanks in advance.
> --
> 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: Open flash chart

2009-08-28 Thread Robert Walker

seja wrote:
> Now open flash is working very fine, but in firefox i want to take
> print where i getting only blank page only.
> Any Idea... Same way is possible to save this flash report as an
> image.

Well, as far as I know Flash won't print. I would guess that Open Flash 
Chart has a way to ask for a "rendered" version of the chart (rendered 
as an image JPEG, PNG or GIF). I'm sure that Fusion Charts has a way to 
do this. I don't know if Open Flash Chart does, but that's what you need 
to investigate. This also means you'll need a "printable" version of 
your view.
-- 
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] partials redrawing

2009-08-28 Thread RVince

I have a select in a partial (_partialInPartial) , which itself is in
a partial (_partial).

_partialInPartial contains a select. WIthin the select, I
have :selected = > nil so that there is nothing selected. When I
redraw it, I therefore expect that nothing will be selected in it.

However, when I render :partial => '_partialInPartial' it is still
retaining the previously selected value

Is this because it is a partial within a partial? If so, how can I get
around this to make certaian a select in  a partial is always set to,
in effect, un-selected? Thanks, RVince
--~--~-~--~~~---~--~~
You received 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: First App- Error 500

2009-08-28 Thread Rick

The error message you're getting indicates that ruby is having a
problem loading a dynamic library.  From the long error report you
posted on Aug 21 it looks like the problem is related to loading the
sqlite3 library:

/!\ FAILSAFE /!\  Fri Aug 21 12:56:58 -0400 2009
  Status: 500 Internal Server Error
  unknown error
C:/Ruby/lib/ruby/1.8/dl/import.rb:29:in `initialize'
C:/Ruby/lib/ruby/1.8/dl/import.rb:29:in `dlopen'
C:/Ruby/lib/ruby/1.8/dl/import.rb:29:in `dlload'
C:/Ruby/lib/ruby/1.8/dl/import.rb:27:in `each'
C:/Ruby/lib/ruby/1.8/dl/import.rb:27:in `dlload'
C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1-x86-mswin32/lib/
sqlite3/driver/dl/api.rb:63

You might want to reinstall the sqlite3-ruby gem:

gem uninstall sqlite3-ruby
gem install sqlite3-ruby



On Aug 26, 10:43 am, mgpowers  wrote:
> Does anyone have any ideas on this ?
>
> I hate to abandon Ruby but the error...
>
> /!\ FAILSAFE /!\  Wed Aug 26 10:40:18 -0400 2009
>   Status: 500 Internal Server Error
>   unknown error
>     C:/Ruby/lib/ruby/1.8/dl/import.rb:29:in `initialize'
>     C:/Ruby/lib/ruby/1.8/dl/import.rb:29:in `dlopen'
>
> Isn't very revealing.why wouldnt my appliaction environment be
> able to show or my first controller work ?
>
> On Aug 21, 1:24 pm, mgpowers  wrote:
>
> > yes...but I still got the same result when I ran the application
> > myfirst 
> > any way to get Ruby , rails to tell us what it really doesnt like  vs.
> > unknownerror
>
> > On Aug 21, 1:06 pm, Rails List 
> > wrote:
>
> > > > I think that was a typo in Rails List's post, it should have been
> > > > ruby script/generate controller myfirst greeting
>
> > > > Colin
>
> > > Ooops. Colin was right.  It was a typo.
> > > --
> > > Posted viahttp://www.ruby-forum.com/.-Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
You received 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* Cannot save a new user to the database...

2009-08-28 Thread RubyonRails_newbie

cheers Colin - i'll try this out.

On 28 Aug, 14:26, Colin Law  wrote:
> 2009/8/28 RubyonRails_newbie :
>
>
>
>
>
>
>
> > Hello,
>
> > I am following the RailsSpace tutorial and am at the point where I am
> > creating a new user through (user/register)
>
> > I have added the details into the form: screen_name, email and
> > password.
>
> > When I click register, I would expect this to be saved (commited) to
> > the database.
>
> > However – when I look in the terminal, it says ‘Rollback’ instead of
> > ‘COMMIT’
>
> > The code in the user controller looks like this:
>
> > class UserController < ApplicationController
>
> >  def register
> >   �...@title = "Register"
> >    if request.post? and params[:user]
> >     �...@user = User.new(params[:user])
> >      if @user.save
> >        flash[:notice] = "User #...@user.screen_name} created!"
> >        redirect_to :action => "index"
>
> I would expect see something like this here, for the case when the save fails
>        else
>          render :action => "new or whatever is is the action that
> posted to register"
>
> >      end
> >    end
> >  end
>
> > Does anyone know why in my terminal it is not saving this as I’d
> > expect?
>
> Maybe your validations are failing, if you have the else condition
> above and then in the new action (or whatever it is) inside the
> form_for you should have <%= f.error_messages %> and the errors will
> appear.
>
> Colin- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received 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* Cannot save a new user to the database...

2009-08-28 Thread Colin Law

2009/8/28 RubyonRails_newbie :
>
> Hello,
>
> I am following the RailsSpace tutorial and am at the point where I am
> creating a new user through (user/register)
>
> I have added the details into the form: screen_name, email and
> password.
>
> When I click register, I would expect this to be saved (commited) to
> the database.
>
> However – when I look in the terminal, it says ‘Rollback’ instead of
> ‘COMMIT’
>
> The code in the user controller looks like this:
>
> class UserController < ApplicationController
>
>  def register
>   �...@title = "Register"
>    if request.post? and params[:user]
>     �...@user = User.new(params[:user])
>      if @user.save
>        flash[:notice] = "User #...@user.screen_name} created!"
>        redirect_to :action => "index"

I would expect see something like this here, for the case when the save fails
   else
 render :action => "new or whatever is is the action that
posted to register"
>      end
>    end
>  end
>
>
> Does anyone know why in my terminal it is not saving this as I’d
> expect?

Maybe your validations are failing, if you have the else condition
above and then in the new action (or whatever it is) inside the
form_for you should have <%= f.error_messages %> and the errors will
appear.

Colin

--~--~-~--~~~---~--~~
You received 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: Adding New Column

2009-08-28 Thread Robert Walker

Bashar Abdullah wrote:
> I think the problem is with the name of the column, :type. It's a
> reserved.

Just to clarify, ActiveRecord assumes a column named type is used for 
Single Table Inheritance. You can configure the model to tell 
ActiveRecord to use a different column name for that purpose, which 
would then allow you to use a column named :type. But, the simpler 
solution is to avoid using :type.

-- 
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: how to insert value to the extra field in join model

2009-08-28 Thread Colin Law

2009/8/28 Kart :
>
> hi all,
>         consider that I'm having 3 models
> 1)user
> 2)doc
> 3)udoc
>
> user model=>(id,name)
> has_many:udocs
> has_many:docs ,through:udocs
>
> doc Model=>(id,name)
> has_many:udocs
> has_many:users ,through:udocs
>
> udoc Model=>(id,user_id,doc_id,start_date,end_date)
> belongs_to:user
> belongs_to;doc
>
> Can anybody just tell how to access the extra field (start_date and
> end_date) in udocs table
> by using User Model

Assuming you have a user in, say, @user, then @user.udocs will give
you an array of Udoc objects so you can do things like
@user.udocs[0].start_date
or
@user.udocs.each do |udoc|
# do something with udoc.end_date
end

Colin

--~--~-~--~~~---~--~~
You received 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 action inside js template

2009-08-28 Thread Fabio Kreusch

Hello all,

I'm trying to create the following:

There is a index page that lists some items, and 'new item' button. I
want the user to be able to click the button, and with ajax the page
will be refreshed to show the new item form.

For that, I added a format.js on my controller, and created a
new.js.erb file for the action.

My problem is, how can I, inside the new.js template, print the
new.html action?

Something like this:
  $("#inner-content").html("<%= escape_javascript(render(:action =>
'new')) %>");

It doesn't work. Do I really have to create a partial for the entire
form to accomplish this?

Thank you!

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



[Rails] *Please Help* Cannot save a new user to the database...

2009-08-28 Thread RubyonRails_newbie

Hello,

I am following the RailsSpace tutorial and am at the point where I am
creating a new user through (user/register)

I have added the details into the form: screen_name, email and
password.

When I click register, I would expect this to be saved (commited) to
the database.

However – when I look in the terminal, it says ‘Rollback’ instead of
‘COMMIT’

The code in the user controller looks like this:

class UserController < ApplicationController

  def register
@title = "Register"
if request.post? and params[:user]
  @user = User.new(params[:user])
  if @user.save
flash[:notice] = "User #...@user.screen_name} created!"
redirect_to :action => "index"
  end
end
  end


Does anyone know why in my terminal it is not saving this as I’d
expect?

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



[Rails] how to insert value to the extra field in join model

2009-08-28 Thread Kart

hi all,
 consider that I'm having 3 models
1)user
2)doc
3)udoc

user model=>(id,name)
has_many:udocs
has_many:docs ,through:udocs

doc Model=>(id,name)
has_many:udocs
has_many:users ,through:udocs

udoc Model=>(id,user_id,doc_id,start_date,end_date)
belongs_to:user
belongs_to;doc

Can anybody just tell how to access the extra field (start_date and
end_date) in udocs table
by using User Model

--~--~-~--~~~---~--~~
You received 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] A resource named "image" gives problems

2009-08-28 Thread Jarl Friis

Hi.

I can't be the only one in the world having the wonderful idea to have
a resource named "image".

I have a controller named images_controller
I have a route named "image", and therefore a helper called
image_path(id). 

But using image_path in an action view erb file gives problems, there
another helper named image_path[1] is defined, hence I can no longer
use the named route url helper image_path

For now I have changed my routes.rb from
map.resources :images
to
map.resources :images, :singular => "my_image",

Then I can use my_image_path in action views.

But... Isn't image such a common word for a resource that [1] should
have a different name, e.g. asset_path, image_asset_path, or something
else. There is already an alias path_to_image[1]. How about just stick to
that?

What do you say?

There are some others having this problem: [2]

Jarl


Footnotes: 
[1]  
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001720

[2]  http://forums.pragprog.com/forums/59/topics/2723



--~--~-~--~~~---~--~~
You received 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: Why can't I post in the JRuby mailing list?

2009-08-28 Thread RVince

pyou cant post to it through google groups. You have to go in an
physically join their list. The postings APPEAR in google groups, but
posting to and replying to posts must be done through their list via
emailing u...@jruby.codehaus.org . You can subscribe to their list at:
http://xircles.codehaus.org/manage_email/u...@jruby.codehaus.org
-Rvince

--~--~-~--~~~---~--~~
You received 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] InvalidAuthenticityToken

2009-08-28 Thread karthik k
Hi guys

What does the below line says

ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):
  -e:2:in `load'
  -e:2

Please guide me



-- 
Karthik.k
Mobile - +91-9894991640

--~--~-~--~~~---~--~~
You received 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: SWF multiple file upload

2009-08-28 Thread mahesh s
Thank you guys

 i got the solution with help of ur reference, now im trying to view the
file when im clicking the appropriate link i got the result when im try to
show the image but i have a problem when im try in to some other file like
pdf or doc .etc

in my controller i use the following code for show my file
asset_controller.rb
def show
  puts params.inspect
@asset = Asset.find(params[:id])
@file_path =  ENV["PWD"] +"/public/#...@asset.public_filename}"
content_type = @asset.content_type
send_file(@file_path , :type => content_type, :disposition => 'inline')
end

show html.erb

i use the following code to show the image:

<%= image_tag(@asset.public_filename) %>

what can i do for show the other file

Ur's
Mahesh


On Fri, Aug 28, 2009 at 1:37 PM, Peter De Berdt
wrote:

>
> On 28 Aug 2009, at 09:34, Nik Cool wrote:
>
> Im new to rails i would like to create app with swf file upload with
>
> multiple file upload,
>
> is that any sample app is available with multiple file uploads plz
>
> give me some reference for me
>
>
> Ur's
>
> Mahesh
>
>
> Use Acts_As_Attachment plugin
>
>
> http://www.flex888.com/122/multiple-file-upload-with-ruby-on-rails-acts_as_attachment.html
>
>
> Acts_as_attachment has been replaced a long time ago with attachment_fu,
> this post dates from two years ago. But indeed, you could use attachment_fu
> instead of paperclip, that's personal preference. Paperclip does have a few
> advantages over attachment_fu if you need custom processing though (video
> thumbnailing etc). Not that it can't be done with attachment_fu, but I can't
> help it feeling a bit hacky to say the least.
>
>
> Best regards
>
>
> Peter De Berdt
>
>
> >
>

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



[Rails] How to run rake thinking_sphinx:index in test environment ?

2009-08-28 Thread Nilesh Kulkarni

Hi,

I tried 'rake thinking_sphinx:index RAILS_ENV=test'

but it throws following error

F:\test_sarasaves\sarasaves>rake thinking_sphinx:index RAILS_ENV=test
(in F:/test_sarasaves/sarasaves)
Generating Configuration to F:/test_sarasaves/sarasaves/config/
test.sphinx.conf
Sphinx 0.9.8-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff

using config file 'F:/test_sarasaves/sarasaves/config/
test.sphinx.conf'...
FATAL: no sources found in config file.
rake aborted!
The following command failed:
  indexer --config F:/test_sarasaves/sarasaves/config/test.sphinx.conf
--all
-- 
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: No route matches "/%20questions/showans/1" with {:method=>:g

2009-08-28 Thread Colin Law

2009/8/28 Salman Lada :
>
> Hi
> i face this problem when i submit the information while evaluating the a
> new page in a already done scaffold...the new page is
> "showans"..i write the link_to tag like this " <%= link_to 'Submit',
> :controller => " questions", :action => "showans", :id => @question.id
> %>"

I think the space in " questions" is causing the problem.  This can be
seen in the error as %20 is a space.

Colin

--~--~-~--~~~---~--~~
You received 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: SWF multiple file upload

2009-08-28 Thread Peter De Berdt

On 28 Aug 2009, at 09:34, Nik Cool wrote:

>> Im new to rails i would like to create app with swf file upload with
>> multiple file upload,
>> is that any sample app is available with multiple file uploads plz
>> give me some reference for me
>>
>> Ur's
>> Mahesh
>
> Use Acts_As_Attachment plugin
>
> http://www.flex888.com/122/multiple-file-upload-with-ruby-on-rails-acts_as_attachment.html

Acts_as_attachment has been replaced a long time ago with  
attachment_fu, this post dates from two years ago. But indeed, you  
could use attachment_fu instead of paperclip, that's personal  
preference. Paperclip does have a few advantages over attachment_fu if  
you need custom processing though (video thumbnailing etc). Not that  
it can't be done with attachment_fu, but I can't help it feeling a bit  
hacky to say the least.


Best regards

Peter De Berdt


--~--~-~--~~~---~--~~
You received 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: Date precedence validation (ex. Round Trip travel dates)

2009-08-28 Thread Nik Cool


> Any ideas?
> Kind regards
> Axinte

validates_date_time plug in may 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-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: JRuby vs Ruby: why would you ever use ruby?

2009-08-28 Thread Gianluca Tessarolo
Many thanks for the suggestion, but the problem is still here...

My runtime configuration now is:

t...@tex-laptop:~xxx$ jruby -S glassfish
Parsing config file: /home/tex/xxx/config/glassfish.yml
Arguments:
runtimes=>1
runtimes_min=>1
runtimes_max=>1
contextroot=>/
environment=>production
app_dir=>/home/tex/xxx
port=>3000
pid=>
log=>/home/tex/xxx/log/production.log
log_console=>false
log_level=>7
daemon=>false
jvm_options=>
domain_dir=>/home/tex/xxx/tmp/.glassfish
Starting GlassFish server at: 127.0.0.1:3000 in production environment...
Writing log messages to: /home/tex/xxx/log/production.log.
Press Ctrl+C to stop.

The problem is always the same: 40 seconds for the 4th response...

I think I'm the only one on the heart that cannot run rails with JRuby 
with multiple concurrent requests, all the other out there seems that 
can run it without any problem (maybe I'm unlucky, sigh...)

> I believe for Jruby the min and max runtimes need to bet set to 1 for
> this to happen and work with config.threadsafe!
>
> AD
>
> On Thu, Aug 27, 2009 at 9:18 AM, Gianluca
> Tessarolo wrote:
>   
>> Sorry, I still can't understand how to run rails in thread safe mode under
>> JRuby (one running instance supporting multiple concurrent requests).
>>
>> If I try to enable config.threadsafe! in config/environments/production.rb
>> under Glassfish Gem my Rails application still run single threaded.
>>
>> Here a very simple example (environment is: glassfish gem v. 0.9.5 / jruby
>> 1.3.1 / rails 2.3.3 / ubuntu 9.04 / notebook centrino dual core / 2gb Ram):
>>
>> rails concurrent
>> cd concurrent
>> script/generate controller test test
>>
>> edit app/controllers/test_controller.rb, modify source as follow:
>>
>> class TestController < ApplicationController
>>   def test
>> @value = Time.now
>> sleep 10
>>   end
>> end
>>
>> edit app/views/test/test.html.erb, modify source as follow:
>>
>> <%= @value %>
>>
>> edit config/environments/production.rb, uncomment last line as follow:
>>
>> config.threadsafe!
>>
>> edit config/environemt.rbm uncomment frameworks line as follow (no database,
>> resource, mail support for this very simple
>> test...):
>>
>> config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
>>
>> Now run:
>>
>> jruby -S gfrake config
>>
>> edit config/glassfish.yml, modify config as follow (notice 4 runtime
>> instances !):
>>
>> environment: production
>> jruby-runtime-pool:
>> initial: 4
>> min: 4
>> max: 4
>>
>> And finally start glassfish gem:
>>
>> jruby -S glassfish
>>
>> Now, if you try to call 4 times (concurrently) the following url...
>>
>> http://localhost:3000/test/test
>>
>> ...you must wait 40 seconds for the 4th response...
>>
>> This is a wrong behaviour because trying the same test under phusion
>> passenger I wait only 10 seconds for the 4th response
>> (in fact passenger start up 4 rails processes, 1 for each concurrent
>> request)...
>>
>> I want to know if is it possible to run Rails with only one running instance
>> supporting multiple concurrent requests...
>>
>> Many thanks in advance...
>>
>> At 10:45 PM -0700 8/15/09, AlwaysCharging wrote:
>>
>>
>> Why would anyone use ruby over Jruby?  I'm admittedly a noob about all
>> this stuff, but from what I've read jruby seems superior to ruby and
>> quite a bit faster.  What would be the disadvantages of JRuby?  I man
>> it's possible to use it with rails now, and JRuby is what's used by
>> default in netbeans (which is the ide I think I've settled on).  So
>> why not JRuby?  Would the tutorials be all that different?
>>
>>
>> I use both MRI and JRuby -- often at the same time in the same
>> project when developing.
>>
>> One advantage I didn't see in the thread so for MRI is that the
>> interpreter starts fast. This is great when starting lots of small
>> tasks from the console.
>>
>> Here's a couple of pluses for JRuby that I haven't seen mentioned:
>>
>> 1) It is very easy to make multiple, complete, and isolated Ruby
>> installation using JRuby. I know there are some tools to make this
>> easier in MRI -- I even wrote a simple one -- but this is trivial in
>> JRuby.
>>
>> 2) For some rendering operations in development mode JRuby can be 20x
>> faster.
>>
>> This is a strange result -- in general I've found JRuby to be about
>> twice as fast as MRI in production ... but I'd never seen this result
>> before ...
>>
>> I've got a complex Rails application for authoring secondary science
>> investigations and one of the render tasks generates a composite xml
>> document that represents all of the objects in an investigation.
>> Right now the largest investigation is about 350k rendered into xml
>> and represents over 1100 objects. Roughly that corresponds to about
>> 1100 partial calls.
>>
>> I have not done ANY work on improving performance in the rendering
>> speed yet (lots of partials calling partials) and noticed that the
>> render speed when running in MRI in deve

[Rails] Re: Authorize.net CIM(Customer Information Manager)

2009-08-28 Thread Nik Cool

Ghanshyam Rathod wrote:
> Hi all,
> 
> Please help me out for authorize.net CIM(customer information manager)
> implementation.
> 
> thanks

go to this site
http://www.rubyplus.org/episodes/68-Rails-with-Active-Merchant-Authorize-Net-CIM-Gateway.html
-- 
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: Authorize.net CIM(Customer Information Manager)

2009-08-28 Thread robdoan

You can use this plugin
http://github.com/Shopify/active_merchant/tree/master


--~--~-~--~~~---~--~~
You received 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: SWF multiple file upload

2009-08-28 Thread Peter De Berdt


On 28 Aug 2009, at 08:25, mahesh wrote:

> Im new to rails i would like to create app with swf file upload with
> multiple file upload,
> is that any sample app is available with multiple file uploads plz
> give me some reference for me

http://www.google.com/search?client=safari&rls=en&q=paperclip+swfupload&ie=UTF-8&oe=UTF-8

--~--~-~--~~~---~--~~
You received 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: No route matches "/%20questions/showans/1" with {:method=>:g

2009-08-28 Thread Ghanshyam Rathod

Salman Lada wrote:
> Hi
> i face this problem when i submit the information while evaluating the a
> new page in a already done scaffold...the new page is
> "showans"..i write the link_to tag like this " <%= link_to 'Submit',
> :controller => " questions", :action => "showans", :id => @question.id
> %>"


Hi Salman,
Do not Put space after define controller or action in link_to tag..
Use below
<%= link_to 'Submit',
:controller => "questions", :action => "showans", :id => @question.id
%>"


-- 
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] No route matches "/%20questions/showans/1" with {:method=>:g

2009-08-28 Thread Salman Lada

Hi
i face this problem when i submit the information while evaluating the a
new page in a already done scaffold...the new page is
"showans"..i write the link_to tag like this " <%= link_to 'Submit',
:controller => " questions", :action => "showans", :id => @question.id
%>"
-- 
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] Authorize.net CIM(Customer Information Manager)

2009-08-28 Thread Ghanshyam Rathod

Hi all,

Please help me out for authorize.net CIM(customer information manager)
implementation.

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

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



[Rails] Alert box before Redirecting

2009-08-28 Thread Charanya Nagarajan

Hi all

I have a form.On filling the details and clicking submit,i would like to
pop up an alert box if the form was saved successfully before
redirecting to the entry's show page.
Kindly 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-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: SWF multiple file upload

2009-08-28 Thread heimdull

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



[Rails] Re: Setting @request.env["HTTP_REFERER"] in an integration test

2009-08-28 Thread Jarl Friis

Thanks david.

David Angga  writes:

> 1.  (*) text/plain  ( ) text/html   
>
> you can do it like this:
>
> @headers ||= {}
> @headers["HTTP_REFERER"] = "previous_link_url"
>
> get/put/post some_link_url, nil, @headers
>
> hope this would help you.

Well I got that far my self. My question is "What is the value of the
previous request?" Note: I am talking about an integration test.

So I would expect the previous url to be found in something like this
@response.full_url

Which would make me do like this
@headers["HTTP_REFERER"] = @response.full_url

For now I have made 
get/put/post some_link_url, nil, { "HTTP_REFERER" => @request.url }

I think actually that was the value that I was seeking.

I wonder why this is not set automatically in 
ActionController::Integration::Session#get
ActionController::Integration::Session#put
ActionController::Integration::Session#post

Jarl


--~--~-~--~~~---~--~~
You received 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] Help with Select

2009-08-28 Thread Quee Mm

I have the following three items in the db:

:year_made
# a value between 1980 and Time.now.year

:year_imported
# "Local" or a value between :year_made and Time.now.year

:year_registered
#If :year_imported == "Local"
 # a value between :year_made and Time.now.year
#else
 # a value between :year_imported and Time.now.year
#end

I am trying to build drop downs which follow these rules and am running
into difficulties. Any help in building these where they work both in
new and edit action (with the correct value as saved in db preselected
will be greatly appreciated)
-- 
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: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread Chris Dekker

nas wrote:
> Check this
> 
> http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails
> 
> On Aug 27, 3:09�pm, Chris Dekker 

Thanks, but that link did not help me.

For MYSQL it doesn't even work. Stored procedures are called through 
'CALL', not 'EXECUTE'.

Also as I wrote in my third post, I already get the stored procedure to 
execute, the problem seems to lie in the closing / freeing of the result 
set.

Calling .free on the returned result set does not solve anything. Tested 
on both the latest 5.0 and 5.1 MySQL databases with the newest 2.8.1 
mysql gem
-- 
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: Asserting PUT methods

2009-08-28 Thread Jarl Friis

Jason Stewart  writes:

> You can do something like assert_select "a[onclick=?]", / here>/

Yes, for now I have made like this:
assert_select "a#{PUT}[href=?]", order_path(order, :update_timestamp => true)

and I have declared PUT in test_helper like this:
  PUT = "[onclick=\"var f = document.createElement('form'); f.style.display = 
'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 
this.href;var m = document.createElement('input'); m.setAttribute('type', 
'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'put'); 
f.appendChild(m);f.submit();return false;\"]"

Fortunately this PUT value is a constant because it refers to
'this.href', but my tests will break if any other javascript is
generated (in newer version of rails) that has the same functionality,
but differs in just a single space. I hoped to have some kind of test
that the execution of the javascript would result in a HTTP PUT
request.

Jarl


--~--~-~--~~~---~--~~
You received 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: Adding New Column

2009-08-28 Thread Colin Law

2009/8/28 techtimer :
>
> Thank you. I removed type and created a new field. Everything is
> working great thanks for your help.
>

For future reference a list of words to avoid can be found at
http://wiki.rubyonrails.org/rails/pages/ReservedWords

Colin

--~--~-~--~~~---~--~~
You received 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: SWF multiple file upload

2009-08-28 Thread Nik Cool

mahesh wrote:
> Hi guys
> 
> Im new to rails i would like to create app with swf file upload with
> multiple file upload,
> is that any sample app is available with multiple file uploads plz
> give me some reference for me
> 
> Ur's
> Mahesh

Use Acts_As_Attachment plugin

http://www.flex888.com/122/multiple-file-upload-with-ruby-on-rails-acts_as_attachment.html
-- 
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] 1 Form > 2 Models > 2nd Model Requres 1st Model ID

2009-08-28 Thread brianp

Hey Everyone,

So I have one form that submits information to create 2 models (A, B).
I need the ID of model A to be inserted into model B. But the ID isn't
created until it hits the database (auto_increment). But if for some
reason either item cannot be created or saved I want to abort the
whole operation.

Whats the best method to do this ?

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] has_and_belongs_to_many with default

2009-08-28 Thread Aldo Italo

hi,
i have used a relaction has_and_belongs_to_many to implementing a
backoffice where the customer settings categories and products: the
products can have multiple categories, it selet them with a combobox.
Now the problem is the customer ask me needly to choice a category by
default: products are indicizated on google, when this links are opening
the product must by reporting the default category.
how i obtain this with an  has_and_belongs_to_many relaction?
-- 
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: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread nas

Check this

http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails

On Aug 27, 3:09 pm, Chris Dekker 
wrote:
> Adding the 65536 flag seems to allow me to gather a resultset from the
> stored procedure, yet my commands go out of sync. Running any query
> (even a simple Model.first) after running a Stored Proc that returns
> results gives this error:
>
> ActiveRecord::StatementInvalid: Mysql::Error: Commands out of sync; you
> can't run this command now: call scores(DATE('2009-08-24'), 3282, 1);
> --
> 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: rake db:test:clone_structure and related tasks fail

2009-08-28 Thread Nik Cool


> rake aborted!
> wrong number of arguments (2 for 1)
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:
> 344:in `recreate_database'
> 
> Thanks!
> Thomas


do you have test database created ?
-- 
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
-~--~~~~--~~--~--~---



  1   2   >