Engines

This page:

http://www.rails-engines.org/download

makes it sound like SVN is optional for using engines, but when I try to
run the second
command (“ruby script/plugin install engines”), I get the NoMethodError
on nil as
described in the second issue reported here:

http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues

So, which is it? Do I have to have SVN installed to use engines?

b

It’s more correct to say that the plugin installer script provided
with Rails itself seems to require SVN - can you install any plugins
using that script? I’m not sure why this might be the case, because
there is certainly implementation in plugin.rb for falling-back to
HTTP only.

  • james

It doesn’t look like my plugin script is going to work for any
plugins…

C:\workspace31\engineTest>ruby script\plugin list
script/plugin: No such file or directory - svn ls
http://dev.rubyonrails.com/svn/rails/plugins/
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:313:in
plugins': private method
split’ called for nil:NilClass (NoMethodError)
etc…

I took a quick look at plugin.rb and it looks like it’s supposed to
check if I have the
“svn” command, and fall back to http if not. But apparently that ain’t
happening. Will try
to debug more tonight.

As a side question, yesterday I discovered that I had been using rails
0.10.0 all along
(gem thought that 0.10.0 is newer than 1.0!?) and after I successfully
got 1.0 installed,
I started to notice the *nix shebang line everywhere… might that be a
problem? My rails
apps all appear to still work though…

b

Since engines are installed using the exact same mechanism as
plugins, this problem can’t be specific to them. Can anyone else
comment, or shed some light as to why the plugin installer seems to
need SVN?

I don’t know if it was “required” but I had to install subversion
(svn) in order to install the login engine.

Greg

On 1/24/06, Ben M. [email protected] wrote:

So, which is it? Do I have to have SVN installed to use engines?

b


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Greg F.
The Norcross Group
Forensics for the 21st Century

Hello,

I am learning Ruby on Rails and have a very basic question.

  def self.home_categories (portal_id)
      find(:all,
           :conditions => "portal_id=:portal_id"
      )
  end

How can I put the value of portal_id in the string “portal_id=…”. I
tried concatenation but I get the error that it cannot convert.

I can figure it out eventually but thought someone may have the
answer ready.

Thanks
Frank

Yeah, sorry… I said I was going to debug this some more but then I got
sidetracked…

I left off looking at rails-1.0/lib/plugin.rb… the error is thrown on
line 313 in
Repositories#plugins. Looking around in there a bit, it appears the
intention is to try
svn but fall back to http if the commands not found.

I also see that there’s an option to specify a url, but if I do this:

ruby script\plugin list
–source=Peak Obsession

I still get the same error:

script/plugin: No such file or directory - svn ls
http://dev.rubyonrails.com/svn/rails/plugins/
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:313:in
plugins': private method split’ called for nil:NilClass (NoMethodError)
from
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:469:in
parse!' from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:469:in map’

b

Hey,
You probably want something like this

def self.home_categories (portal_id)
find(:all, :conditions => [ “portal_id=?”, portal_id ] )
end

Eric

Easy, ruby can embed expressions into strings:

  def self.home_categories (portal_id)
      find(:all,
           :conditions => "portal_id=#{portal_id}"
      )
  end

The #{…} syntax acts like ruby code inside your string, so the value
of portal_id gets into your conditions.

Now, the fact you are putting this value directly into a SQL statement
might be troubling - it it’s from some sort of form submission or URL
you are opening yourself to SQL injection attacks there.

I did send a new message to [email protected].

Don’t know how it happened. I made sure to put a unique/new subject
line “How to use a parameter with a string?”

I do know how to submit a question just don’t know how it got mixed
up.

My apologies anyway to the list members.

Frank

Ben M. [email protected] wrote: Wow, you somehow replied to one
thread with the subject line from another thread and were
starting a completly new thread!

Please, when you have a new question, compose a fresh, new email
addressed to
[email protected] and with a subject line that relates to your
question… It
makes the sheer volume of this list easier to manage.

Thanks,

b

Wow, you somehow replied to one thread with the subject line from
another thread and were
starting a completly new thread!

Please, when you have a new question, compose a fresh, new email
addressed to
[email protected] and with a subject line that relates to your
question… It
makes the sheer volume of this list easier to manage.

Thanks,

b

Thanks Eric for your reply.

Eric G. [email protected] wrote: Hey,
You probably want something like this

def self.home_categories (portal_id)
find(:all, :conditions => [ “portal_id=?”, portal_id ] )
end

Eric

Thanks Justin for your answer and the detailed explanation.

I appreciate it very much.

Frank

Justin B. [email protected] wrote: Easy, ruby can embed
expressions into strings:

  def self.home_categories (portal_id)
      find(:all,
           :conditions => "portal_id=#{portal_id}"
      )
  end

The #{…} syntax acts like ruby code inside your string, so the value
of portal_id gets into your conditions.

Now, the fact you are putting this value directly into a SQL statement
might be troubling - it it’s from some sort of form submission or URL
you are opening yourself to SQL injection attacks there.

No, I am not using a direct value from the forms.

However, I would appreciate if you can tell me how would one add
slashes to the string, or replace the quotes from the input value. I
know it can be done in PHP using addslashes and str_replace. What are
the appropriate functions in Ruby on Rails?

I am sure many of us starting out on ROR would benefit from your
answer.

Thanks for your assistance.
Frank

Justin B. [email protected] wrote:Now, the fact you are putting
this value directly into a SQL statement
might be troubling - it it’s from some sort of form submission or URL
you are opening yourself to SQL injection attacks there.

Frank-

You do not need to call any special functions to add slashes or

escape things for the database in rails as long as you use the place
holder syntax. So if you just get in the habit of always using the ?
placeholders like you were shown with the snippet below, you will not
have to worry about escaping anything before inserting or querying
the db:

def self.home_categories (portal_id)
find(:all, :conditions => [ “portal_id=?”, portal_id ] )
end

This is the important syntax:

:conditions => [ “portal_id=?”, portal_id ]

Cheers-
-Ezra

PS. what was meant when someone mentioned that you highjacked a
thread in the list was that if you hit reply to an even replace the
subject line. the in-reply-to headers that the mailing list uses to
put together threads will lump your post in with the previous thread
you replied to. So in the future when you want to start a new thread,
please make sure to create a fresh new email in your email client and
send it to the address: [email protected] and you will
avoid the thread highjacking.

PPS. Welcome to the rails community. You will like it here.

On Jan 25, 2006, at 6:50 PM, softwareengineer 99 wrote:

Thanks for your assistance.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
[email protected]
509-577-7732