Forum: Ruby on Rails engines

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ben M. (Guest)
on 2006-01-24 08:43
(Received via mailing list)
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+pl...

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

b
James A. (Guest)
on 2006-01-24 11:51
(Received via mailing list)
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
Ben M. (Guest)
on 2006-01-24 19:35
(Received via mailing list)
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
Greg F. (Guest)
on 2006-01-26 01:42
(Received via mailing list)
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. <removed_email_address@domain.invalid> wrote:
> So, which is it? Do I have to have SVN installed to use engines?
>
> b
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Greg F.
The Norcross Group
Forensics for the 21st Century
James A. (Guest)
on 2006-01-26 01:54
(Received via mailing list)
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?
Ben M. (Guest)
on 2006-01-26 02:27
(Received via mailing list)
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=http://dev.rubyonrails.com/svn/rails/plugins/

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
softwareengineer 99 (Guest)
on 2006-01-26 02:42
(Received via mailing list)
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
Justin B. (Guest)
on 2006-01-26 02:46
(Received via mailing list)
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.
Eric G. (Guest)
on 2006-01-26 02:49
(Received via mailing list)
Hey,
You probably want something like this

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

Eric
Ben M. (Guest)
on 2006-01-26 03:04
(Received via mailing list)
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
removed_email_address@domain.invalid and with a subject line that relates to 
your
question.... It
makes the sheer volume of this list easier to manage.

Thanks,

b
softwareengineer 99 (Guest)
on 2006-01-26 04:28
(Received via mailing list)
I did send a new message to removed_email_address@domain.invalid.

  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. <removed_email_address@domain.invalid> 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
removed_email_address@domain.invalid and with a subject line that relates to 
your
question.... It
makes the sheer volume of this list easier to manage.

Thanks,

b
softwareengineer 99 (Guest)
on 2006-01-26 04:31
(Received via mailing list)
Thanks Justin for your answer and the detailed explanation.

  I appreciate it very much.

  Frank

Justin B. <removed_email_address@domain.invalid> 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.
softwareengineer 99 (Guest)
on 2006-01-26 04:46
(Received via mailing list)
Thanks Eric for your reply.

Eric G. <removed_email_address@domain.invalid> wrote:  Hey,
You probably want something like this

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

Eric
softwareengineer 99 (Guest)
on 2006-01-26 04:52
(Received via mailing list)
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. <removed_email_address@domain.invalid> 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.
Ezra Z. (Guest)
on 2006-01-26 07:56
(Received via mailing list)
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: removed_email_address@domain.invalid  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
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732
This topic is locked and can not be replied to.