Ruby on Rails Sunday, October 31, 2010

egervari wrote in post #913624:
> Anyway, our site has to support a lot of traffic, requires a lot of
> cron-like stuff built into the application, and we'll need to support
> relational databases and something like cassandra.
>
> Suggestions?

Here's my one suggestion. Go try Rails for yourself. If you have
specific questions that you need help with then ask them here.

Asking abstract questions like these on a forum dedicated to Rails is
going to get you nowhere. It's pointless really. All that will ever
happen is exactly what you see here. It starts a firestorm of defensive
responses and un-constructive conversation that just ends up wasting
everyone's time.

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

Ruby on Rails

Yes exactly Jakub! The main problem is that Heroku (The hoster) does not
allow any storing of files on their filesystem. Is there any other way?

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

Ruby on Rails

same problem here... any ideas guys?

On Oct 29, 3:28 am, tom <tomabr...@gmail.com> wrote:
> hi , in my logs i see that:
>
> Completed in 1480ms (View: 267, DB: 90) | 200 OK [http://192.168.2.9/xyz/99]
>   SQL (1.4ms)   SET NAMES 'utf8'
>   SQL (0.7ms)   SET SQL_AUTO_IS_NULL=0
>
> Processing xyzsController#images to gif (for 192.168.2.3 at 2010-10-28
> 15:22:35) [GET]
>   Parameters: {"id"=>"loading"}
>
> ActionController::UnknownAction (No action responded to images.
>
> then to stop the error,  i created an action plus view, although it doesnt
> get rendered.
>
> > how can i find out who is triggering that action? is there a way at all?
> > i do have a suspicion that this is coming from one of those lightbox
>
> olugins....
>
> thx

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

Ruby on Rails

I setup the war file with warbler. Here's the Gemfile:

source 'http://rubygems.org'
gem 'rails', '3.0.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

#gem 'sqlite3-ruby', :require => 'sqlite3'
gem "activerecord-jdbcmysql-adapter", '1.0.2', :require =>'arjdbc' if
defined?(JRUBY_VERSION)


# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end

In the config/warbler.rb file I also have the following line
uncommented:

config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]

Also, the "jruby -S rails server" command brings up the WEBrick
server not Tomcat.
I propose to run Tomcat in the production environment.

On Oct 31, 12:49 am, mkristian <meier.krist...@gmail.com> wrote:
> can you run
> $ jruby -S rails server
> ?
> how does your Gemfile look like ?
> how do you setup your war files ? with warbler ?
>
> regards, Kristian
>
> On Oct 30, 6:21 am, MJW2529 <mjwhite2...@yahoo.com> wrote:
>
> > Hi,
> > I've been trying to get JRuby 1.5.3 with Rails 3 to run on the Tomcat6
> > server with little success.
> > Has anyone been able to do this?  If so, what issues did you have to
> > overcome to get this to work?
> > Also, is this a combination that you would recommend for a production
> > site, or is it all too new and untested?
> > The latest issue I'm stuck on right now is with the mysql-connector-
> > java-5.0.4 which comes with jruby 1.5.3 which keeps returning
> > JDBCError: Generated keys not requested.
> > Any feedback on this would be appreciated.
> > 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello everyone.

I am having the encoding issue on a simple file upload action:
Encoding::UndefinedConversionError in MainController#upload
"\xC4" from ASCII-8BIT to UTF-8

The action looks like this:
def upload
@uploaded_io = params[:upload]
File.open(Rails.root.join('public', 'images',
@uploaded_io.original_filename), 'w') do |file|
file.write(@uploaded_io.read)
end
end

I changed File.open to 'wb' (binary) and it woked fine. I also tried
switching the ruby version to 1.8.7 while leaving the File.open method
as 'w' (write) which also worked as expected, without any errors.
Should I use 'wb' everytime I want to use files from the filesystem,
or is it the ruby-1.9.2-p0 that comes with RVM cases the issue?

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

Ruby on Rails

I have a form_tag that works fine using html, but when I use ajax with
the remote => true I am getting this error:-
My terminal log shows:-
Started GET "/" for 127.0.0.1 at 2010-11-01 01:19:49 +0000
Processing by HomepagesController#index as HTML
Homepage Load (0.6ms) SELECT "homepages".* FROM "homepages"
Rendered homepages/index.html.erb within layouts/application (23.0ms)
Completed 200 OK in 40ms (Views: 27.3ms | ActiveRecord: 0.6ms)
Error during failsafe response: incompatible encoding regexp match
(UTF-8 regexp with ASCII-8BIT string)
***** then a load of cleaner.rb stuff
then:-
Started GET "/homepages?utf8=%E2%9C%93&search=hom" for 127.0.0.1 at
2010-11-01 01:19:56 +0000
Processing by HomepagesController#index as JS
Parameters: {"utf8"=>"✓", "search"=>"hom"}
Homepage Load (0.5ms) SELECT "homepages".* FROM "homepages" WHERE
(section LIKE '%hom%')
Rendered homepages/index.js.erb (2.9ms)
Completed in 19ms

In my index.js.erb I have:-
$("testsearch").update("<%= escape_javascript(render(@homepages))%>");

and in my Controller I have:-
def index
@homepages = Homepage.search(params[:search])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @homepages }
format.js { render :layout => false }
end
in my view I have:-
<div id = "testsearch"> which prints @homepages using a table using <%
@homepages.each do |homepage| %> which is not being updated.

Anyone have any ideas as to why I get 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hmmm... well i installed that plugin however i am still having no
luck.

form_tag seems to work properly.

my dev log does not give me any errors, just some depreciation warning
unrelated to this problem.

any ideas?

On Oct 27, 11:30 am, Ganesh Kathare <li...@ruby-forum.com> wrote:
> tashfeen.ekram wrote in post #957373:
>
> > I am upgrading to rails 3 and afer diong so, none of myform_forare
> > working. (I can not actually say not all of them are working but the
> > few that i have tried are not). The page loads fine but the form is
> > not output. This is after making the the change from <% to <%=. A
> > sample form is below.
>
> > <%=form_for@user_session, :url => user_session_path do |f| %>
> >   Email <br/>
> >   <%= text_field_tag :login %><br/>
> >   Password <br/>
> >   <%= f.password_field :password %><br/>
> >   Remember Me
> >   <%= f.check_box :remember_me %> <br/>
> >   <%= f.submit "Login" %>
> > <% end %>
>
> Hi,
>
> In that case you need to use 'dynamic-form' plugin for rails3
>
> http://github.com/rails/dynamic_form
>
> This plugin can auto modify you syntax at runtime.
>
> Good Luck ;)
> -Ganesh K
>
> --
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

David,

Just to add some context, what you experienced pretty much applies to
all lanuages that offer access to xml, and the reason is the W3C XML
specification requires this behavior. When any XML parser reads the
XML, CDATA sections are not preserved. The text property returns the
text node of an element and if the element happens to have a CDATA
section, then the text part if it is returned along with any other
text content of the element.


On Oct 31, 4:09 pm, David Kahn <d...@structuralartistry.com> wrote:
> SOLVED: Guess posting this got me more curious and I figured it out:
>
> If I ask for
> my_file.xpath("//EMBEDDED_FILE/DOCUMENT").text
>
> Nokogiri automatically takes the content within the cdata element within the
> DOCUMENT node and returns it to me without the cdata. Nice. So just a case
> of making things harder for myself.
>
> On Sun, Oct 31, 2010 at 4:59 PM, David Kahn <d...@structuralartistry.com>wrote:
>
>
>
> > This is an extension of my last post (problems with REXML) which has me
> > looking to Nokogiri again. The reason I am not using Nokogiri is I can not
> > seem to find a way to get CDATA out of a Nokogiri document.
>
> > First, can you tell me if I am loading my document correctly, because when
> > I call my_document.to_xml, I only get one line back:
>
> > (rdb:1) test_file = Nokogiri::XML(mismo_xml_file)
> > #<Nokogiri::XML::Document:0x5dd22 name="document">
> > (rdb:1) test_file.to_xml
> > "<?xml version=\"1.0\"?>\n"
>
> > So maybe this is the first step and if I get the full doc to load, my cdata
> > will be there?!!
>
> > Alternatively, if you have a code snippet of loading a doc and successfully
> > getting CDATA out, that would be a great help!
>
> > Thanks in advance,
>
> > David

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

Ruby on Rails

SOLVED: Guess posting this got me more curious and I figured it out:

If I ask for
my_file.xpath("//EMBEDDED_FILE/DOCUMENT").text

Nokogiri automatically takes the content within the cdata element within the DOCUMENT node and returns it to me without the cdata. Nice. So just a case of making things harder for myself.



On Sun, Oct 31, 2010 at 4:59 PM, David Kahn <dk@structuralartistry.com> wrote:
This is an extension of my last post (problems with REXML) which has me looking to Nokogiri again. The reason I am not using Nokogiri is I can not seem to find a way to get CDATA out of a Nokogiri document.

First, can you tell me if I am loading my document correctly, because when I call my_document.to_xml, I only get one line back:

(rdb:1) test_file = Nokogiri::XML(mismo_xml_file)
#<Nokogiri::XML::Document:0x5dd22 name="document">
(rdb:1) test_file.to_xml
"<?xml version=\"1.0\"?>\n"

So maybe this is the first step and if I get the full doc to load, my cdata will be there?!!

Alternatively, if you have a code snippet of loading a doc and successfully getting CDATA out, that would be a great help!

Thanks in advance,

David


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

Ruby on Rails

This is an extension of my last post (problems with REXML) which has me looking to Nokogiri again. The reason I am not using Nokogiri is I can not seem to find a way to get CDATA out of a Nokogiri document.

First, can you tell me if I am loading my document correctly, because when I call my_document.to_xml, I only get one line back:

(rdb:1) test_file = Nokogiri::XML(mismo_xml_file)
#<Nokogiri::XML::Document:0x5dd22 name="document">
(rdb:1) test_file.to_xml
"<?xml version=\"1.0\"?>\n"

So maybe this is the first step and if I get the full doc to load, my cdata will be there?!!

Alternatively, if you have a code snippet of loading a doc and successfully getting CDATA out, that would be a great help!

Thanks in advance,

David

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

Ruby on Rails

I have a class and test for it which was running reasonable fast in Rails 2.3.8/Ruby 1.8.7 (1 second)

Now that I have updated this app to Rails 3/1.9.2, the same test takes 4 minutes!!!

I have honed in on the slow code which is where REXML loads a pretty short xml document:

@mismo_file = REXML::Document.new mismo_xml_file 

This line takes just short of forever whenever it is hit. What could it be doing? I am wondering if there are any others who have encountered the same problem or a way to solve it. Everything else (the document, the computer, and my own code) is a constant, the Ruby and Rails v's are only differences.



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

Ruby on Rails

Solved now,

>> require 'active_support/all'
=> true
>> Time.now.beginning_of_day
=> Mon Nov 01 00:00:00 1300 2010


Ben Williams wrote in post #957932:
> Please can anyone explain why this works in rails but not in irb ?
>
>>> require 'active_support'
> => true
>>> Time.now.beginning_of_day
> NoMethodError: undefined method `beginning_of_day' for Fri Oct 29
> 14:05:28 +1300 2010:Time
> from (irb):2
>
>
> Thanks
> Ben
>

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

Ruby on Rails

He has a PHP script that do "the thing" with amazon, but now he needs
to tailor the Rails front-end app with that script through cURL. Right
Moritz?

You can execute cURL through Rails controllers like:

class SomeController < ...
def execute_my_php_script
`curl http://myscript.moritz.com [options]` # you need to know how
to run curl properly here
end
end

> - I have never worked with MVC before
> - I'm pretty good with PHP but I completely suck at RoR

http://guides.rubyonrails.org/

Cheers!
Jakub Godawa

On 31 Paź, 22:31, Hassan Schroeder <hassan.schroe...@gmail.com> wrote:
> On Sun, Oct 31, 2010 at 1:36 PM, Moritz Bruckner <li...@ruby-forum.com> wrote:
> > No, i've already built a PHP script which can be used to upload images
> > via HTTP POST. Now I'm trying to build some sort of graphical interface
> > with Rails. Thus, this GUI app would need to use cURL to transfer the
> > uploaded images to the API script.
>
> Sorry, I'm not following you at all.
>
> You have a Rails app on Heroku, and you want to store images for
> that app somewhere. So why not just use Paperclip? What's the point
> of a separate upload mechanism?
>
> --
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails


On 31 Oct 2010, at 22:52, Colin Law wrote:

I'm working on my first Rails app and I have a question regarding
authentication. I already have authentication for signing up, logging
in, logging out, etc. What I need is an account email activation
function and a reset password (forgot password) function. I have read
a little bit about Devise and watched the Railscast episodes on it, it
seems nice, but is it possible to add just the functions I mentioned?
And do I need to change a lot in my current models to do it? Or is it
easier to do it manually?

From the Devise documentation at github
(http://github.com/plataformatec/devise):

It's composed of 12 modules:

...
• Confirmable: sends emails with confirmation instructions and verifies
whether an account is already confirmed during sign in.
• Recoverable: resets the user password and sends reset instructions.
...
So you'll need to add "confirmable" and "recoverable" to your devise
settings and then add several fields to the existing database tables:
confirmation_token, confirmed_at, confirmation_sent_at
and
reset_password_token
All of this is just a matter of quickly reading through the Devise source
code and the docs on github. It's there in plain sight.

I may be misinterpreting the original post, but I suspect he is not
actually using Devise at the moment.

Ah yes, shouldn't be skimming mails this late in the evening :-).

To the original poster:

You have two options:
- Replace your current authentication with Devise, which might include renaming some database columns and customizing the Devise encryption method to match your current one
- Use the Authlogic or Devise source code as an inspiration and roll your own.

It all depends on your current authentication to be honest.


Best regards


Peter De Berdt


Ruby on Rails

On 31 October 2010 21:48, Peter De Berdt <peter.de.berdt@pandora.be> wrote:
>
> On 31 Oct 2010, at 22:24, Anders_P wrote:
>
> I'm working on my first Rails app and I have a question regarding
> authentication. I already have authentication for signing up, logging
> in, logging out, etc. What I need is an account email activation
> function and a reset password (forgot password) function. I have read
> a little bit about Devise and watched the Railscast episodes on it, it
> seems nice, but is it possible to add just the functions I mentioned?
> And do I need to change a lot in my current models to do it? Or is it
> easier to do it manually?
>
> From the Devise documentation at github
> (http://github.com/plataformatec/devise):
>
> It's composed of 12 modules:
>
> ...
> • Confirmable: sends emails with confirmation instructions and verifies
> whether an account is already confirmed during sign in.
> • Recoverable: resets the user password and sends reset instructions.
> ...
> So you'll need to add "confirmable" and "recoverable" to your devise
> settings and then add several fields to the existing database tables:
> confirmation_token, confirmed_at, confirmation_sent_at
> and
> reset_password_token
> All of this is just a matter of quickly reading through the Devise source
> code and the docs on github. It's there in plain sight.

I may be misinterpreting the original post, but I suspect he is not
actually using Devise at the moment.

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

Ruby on Rails


On 31 Oct 2010, at 22:24, Anders_P wrote:

I'm working on my first Rails app and I have a question regarding
authentication. I already have authentication for signing up, logging
in, logging out, etc. What I need is an account email activation
function and a reset password (forgot password) function. I have read
a little bit about Devise and watched the Railscast episodes on it, it
seems nice, but is it possible to add just the functions I mentioned?
And do I need to change a lot in my current models to do it? Or is it
easier to do it manually?

From the Devise documentation at github (http://github.com/plataformatec/devise):

It's composed of 12 modules:

...
• Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
• Recoverable: resets the user password and sends reset instructions.
...

So you'll need to add "confirmable" and "recoverable" to your devise settings and then add several fields to the existing database tables:

confirmation_token, confirmed_at, confirmation_sent_at

and

reset_password_token

All of this is just a matter of quickly reading through the Devise source code and the docs on github. It's there in plain sight.


Best regards


Peter De Berdt


Ruby on Rails

On Sun, Oct 31, 2010 at 1:36 PM, Moritz Bruckner <lists@ruby-forum.com> wrote:
> No, i've already built a PHP script which can be used to upload images
> via HTTP POST. Now I'm trying to build some sort of graphical interface
> with Rails. Thus, this GUI app would need to use cURL to transfer the
> uploaded images to the API script.

Sorry, I'm not following you at all.

You have a Rails app on Heroku, and you want to store images for
that app somewhere. So why not just use Paperclip? What's the point
of a separate upload mechanism?

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

Ruby on Rails

On 31 October 2010 20:05, MDM <don.mapp@gmail.com> wrote:
> Both of these works which do you think is best.
>     self.where('section LIKE ?', "%#{search_item}%")
>     self.where('section LIKE ?', '%'+search_item+'%')

personally, I prefer the syntax of the first method; it seems more "Ruby".

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

Ruby on Rails

Hello!

I'm working on my first Rails app and I have a question regarding
authentication. I already have authentication for signing up, logging
in, logging out, etc. What I need is an account email activation
function and a reset password (forgot password) function. I have read
a little bit about Devise and watched the Railscast episodes on it, it
seems nice, but is it possible to add just the functions I mentioned?
And do I need to change a lot in my current models to do it? Or is it
easier to do it manually?

Any tips or recourses and links on how to do it with Devise or
manually would be appreciated!

Thanks
// Anders

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

Ruby on Rails

I get that same "...open=false>" in my console when connecting to S3.
Can you transfer a file through the console commands? See

http://amazon.rubyforge.org/

Also, in the s3.yml file, do you have things in quotes?

development:
bucket: 'teneventsdevelopment'
access_key_id: 'asdfa324234'
secret_access_key: 'qwer2342'

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

Ruby on Rails

No, i've already built a PHP script which can be used to upload images
via HTTP POST. Now I'm trying to build some sort of graphical interface
with Rails. Thus, this GUI app would need to use cURL to transfer the
uploaded images to the API script.

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

Ruby on Rails

On Sun, Oct 31, 2010 at 12:57 PM, Moritz Bruckner <lists@ruby-forum.com> wrote:

> thanks for your reply. Paperclip looks interesting, but as of what
> Google says, it does not support cURL. I've already built a PHP image
> uploading API, and I want to use it with Rails. Is there any way to
> accomplish that or do I have to use PHP?

I'm not sure what you're asking -- you want to use PHP in a Rails app
that runs on Heroku?

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

Ruby on Rails

Wow Thanks Michael
After all this time.
Both of these works which do you think is best.
self.where('section LIKE ?', "%#{search_item}%")
self.where('section LIKE ?', '%'+search_item+'%')
I can now get back to the remote => ajax call.
Pure joy Thanks again Don

On Oct 31, 7:40 pm, Michael Pavling <pavl...@gmail.com> wrote:
> On 31 October 2010 19:36, MDM <don.m...@gmail.com> wrote:
>
> > Thanks Michael
> > I have tried that along with other versions of '%search_item%'without
> >     self.where('section = ?', '%search_item%') does not work and you
> > cannot use %without a ' or "
>
> Oops.... just spotted....
> if you're trying to do a SQL query with "%" you need to use "LIKE"
> instead of "="
>
>    self.where('section LIKE ?', "%#{search_item}%")

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

Ruby on Rails

Cheers for that, that part makes more sense now.

Still getting the same error, now using the path:

:path => "/:attachment/:id/:filename.:extension"

Another thing I noticed, when I sign in to aws-s3 through the rails
console, like this:

Base.establish_connection!(:access_key_id...

I get the message

#<AWS::S3::Connection:0x1035886e0 @http=#<Net::HTTP s3.amazonaws.com:80
open=false>,

which doesn't seem good, however following this I can still access my s3
buckets. Service.buckets returns a complete list.

is the ...open=false> message normal??

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

Ruby on Rails

Hey Hassan,

thanks for your reply. Paperclip looks interesting, but as of what
Google says, it does not support cURL. I've already built a PHP image
uploading API, and I want to use it with Rails. Is there any way to
accomplish that or do I have to use PHP?

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

Ruby on Rails

On Sun, Oct 31, 2010 at 11:45 AM, Mo3 <moritz.bruckner@googlemail.com> wrote:

> But how am I supposed to send files via cURL if I'm not allowed to
> store them on the file system?

Look at the paperclip plugin; it can store uploaded files on Amazon S3,
for instance, so even if you're using some other storage it should give
you some ideas.

And FWIW I've used it for exactly your use case of deploying an app
with an image (photo) upload to Heroku.

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

Ruby on Rails

On 31 October 2010 19:36, MDM <don.mapp@gmail.com> wrote:
> Thanks Michael
> I have tried that along with other versions of '%search_item%'without
>     self.where('section = ?', '%search_item%') does not work and you
> cannot use %without a ' or "

Oops.... just spotted....
if you're trying to do a SQL query with "%" you need to use "LIKE"
instead of "="

self.where('section LIKE ?', "%#{search_item}%")

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

Ruby on Rails

Thanks Michael
I have tried that along with other versions of '%search_item%'without
any joy. Just tried it again. it does not throws an error, but it
returns nothing.
self.where('section = ?', search_item) works with the full word
'Gardening', but not 'Gar'
self.where('section = ?', '%search_item%') does not work and you
cannot use %without a ' or "
self.where('section = ?', '%'search_item'%') is an internal
server error
self.where('section = ?', '%'+search_item+'%') no go either.
Don

On Oct 31, 1:42 pm, Michael Pavling <pavl...@gmail.com> wrote:
> On 31 October 2010 12:09, MDM <don.m...@gmail.com> wrote:
>
> > Thanks for that, but I am still getting a syntax error. Now:-
> > SQLite3::SQLException: near "%": syntax error: SELECT
> > "homepages".* FROM       "homepages"  WHERE     (section = %'Gar'%)
>
> You can't put the question mark inside the percentage signs, as Rails
> SQL-escapes the variable and wraps it in appropriate delimiters...
> hence your error. You need to wrap your string in percentages one way
> or another and pass that in:
>
> self.where('section = ?', "%#{search_item}%")

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

Ruby on Rails

Hey there,

so I've just started to learn Ruby on Rails. I actually managed to
create an simple, one-line-plain-text app and deploy it on Heroku.

The app is supposed to be an image uploading website, but instead of
storing the images on the filesystem, I want them to be cURL'ed to an
image hoster's API.

There are a few major problems..

- I have just started with Ruby on Rails and I've never even touched
MVC
- Storing files on the filesystem is not allowed.

Is there any way to send (uploaded) files via cURL without even
temporarily storing them on the filesystem?

I'd be grateful for any newbie-friendly advice.

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

Ruby on Rails

Hey there,

I'm new to Ruby on Rails. REALLY new. So far, I've managed to create
an app, a controller, a route and I've managed to push this plain-text
application to Heroku and deploy it there.

The app is supposed to be a image uploading website, but instead of
just storing the files on the file system, it should cURL the data to
an image hoster's API and return the image links.

The main problems I'm facing are..

- I have never worked with MVC before
- I'm pretty good with PHP but I completely suck at RoR
- Storing files on Heroku's file system is not allowed

But how am I supposed to send files via cURL if I'm not allowed to
store them on the file system?

I'd be really grateful for any newbie-friendly advice on 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Just a guess on my part, but it looks as if you may want to produce a
LIKE condition in the resultant sql - if so, perhaps something like
(no pun intended ) this will work:

self.where('section LIKE ?', "%#{search_item}%")

> ArgumentError (wrong number of arguments (2 for 0)):
> ******************************************************************
> In my model I have:-
> self.where('section <= ?', "%#{search_item}%")
> or
> self.where(:section => "%#{search_item}%")

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

Ruby on Rails

On Oct 31, 11:01 am, Fritz Trapper <li...@ruby-forum.com> wrote:
> Solution:
> Split the migration: The first creats the new column, the second
> processes the data.
>
> Looks like problem with migrations.
>
Classes cache column information, but you can call
MyClass.reset_column_information to clear that cache.

Fred

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

Ruby on Rails

Hello,

in my controller I use following code to render json.

render :json => @product, :callback => params[:callback]

I would expect (for example) following to be rendered:

callback({"name":"Computer","price":500})

Instead, it renders:

callback([{"name":"Computer","price":500}])

Notice the square brackets which disables $.parseJSON (jQuery) from
parsing it.
Don't you know what am I doing wrong? How can I get rid of those
brackets? When I tried ActiveSupport::JSON.encode() there were no
square brackets.

Thank you very much,
Jakub Svehla

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

Ruby on Rails

A new edition of Rails Magazine is now available, both in print and as
a free pdf at:

http://railsmagazine.com/issues/7

In this number:
* Editorial by Rupak Ganguly
* An Overview of Refinery – a Rails CMS by David Jones
* Converting A Rails Site to Refinery CMS by Christopher W. Lehman
* Auditing plugin by Mihai Târnovan and Gabriel Târnovan
* Hobo – Making Application Development on Rails Even Faster by Dave
Reynolds
* Installing Ruby on Rails on Windows by Victor Thiago
* Simple Unobtrusive Ruby/Rails Debugging by Stephen Rycyk
* A Well Kept Secret, Ruby and Cryptography by Richard Penwell

Please consider sharing an article with the community in the next
issue, or contact us with any feedback.

Thank you,
Olimpiu Metiu
Editor-in-Chief | Rails Magazine

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

Ruby on Rails

Hi Folks,

The guide was updated and has a new address:

http://www.public.traineronrails.com/guides/nosql/pages/01-windows_nosql.htm

Regards.

--
MarcRic
www.marcric.com
http://marcricblog.blogspot.com/
http://www.traineronrails.com/
http://groups.google.com.br/group/riorubyrails

On Oct 25, 1:16 am, MarcRic <marc...@gmail.com> wrote:
> Hi Folks,
>
> I have just published a post here:http://marcricblog.blogspot.com/2010/10/windows-definitive-guide-to-n...
>
> And a Guide here:http://www.public.traineronrails.com/guides/pages/01-windows_nosql.htm
>
> Comments, Suggestions or Fixes are welcome.
>
> Regards.
>
> --
> MarcRicwww.marcric.comhttp://marcricblog.blogspot.com/http://www.traineronrails.com/http://groups.google.com.br/group/riorubyrails

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

Ruby on Rails

1. The polymorphic part isn't necessary. If you just expect to have one
model that has file attachments then it's not going to help you.
However, if you have multiple models that have attachments, then you
might want to go the polymorphic way. See
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations.

2. You're markup should work. On the website, I'm using HAML as a
replacement for ERB. Also, I'm using the 'simple form' gem. So my markup
is going to look different than yours. Plus, I'm using a nested form.

3. The :path is the file path that file will be placed in your S3
account.
In your case, you specified

:styles => { :thumb => "100x100#", :small => "150x150>" }

So when you upload a file, paperclip will generate these two image
styles for you as separate files. If the original file was bigger than
both of these styles, then you'll also have a third 'original' file.

If you have

:path => "/:attachment/:id/:style.:extension"

your S3 file path will be something like '/photo/1/thumb.png'

If you used

:path => "/:style/:id"

your S3 file path would be '/thumb/1'. This won't work because it's not
specific enough. You'll just keep overwriting the same file. ':filename'
is automatically available for you to use because each upload has to
have a filename.

If you're using Firefox, I recommend the 'S3Fox' add-on that will allow
you to browse your S3 account through Firefox.

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

Ruby on Rails

> Not where you'd get questions answered but potentially handy:http://help.github.com/git-cheat-sheets/

Thanks. I'm sure this will be handy.

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

Ruby on Rails

> This should answer most, if not all, of your questions about Git:
>
> http://progit.org/book/

Thanks Robert, but not quite. I had already found the URL before your
post and although I have to admit I have not read the entirety of the
documentation I went through most of the sections I need information
about but either the text didn't offer enough information for what I
need to know or I didn't extrapolate from it what I need to know. I'll
keep reading, though.

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

Ruby on Rails

On 31 October 2010 12:09, MDM <don.mapp@gmail.com> wrote:
> Thanks for that, but I am still getting a syntax error. Now:-
> SQLite3::SQLException: near "%": syntax error: SELECT
> "homepages".* FROM       "homepages"  WHERE     (section = %'Gar'%)
>

You can't put the question mark inside the percentage signs, as Rails
SQL-escapes the variable and wraps it in appropriate delimiters...
hence your error. You need to wrap your string in percentages one way
or another and pass that in:


self.where('section = ?', "%#{search_item}%")

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

Ruby on Rails

yes, I am using it exclusively. performance gain it said there is, but
I guess this depends on your application and you have to measure it.

if you need to you can mix java.

you can run it in servlet engine and get a real multi threaded
environment.

but mainly I use it in conjunction with GWT and using maven as build
tool, so everything seams to be glued together by java. kind of funny:
the backend actually is ruby, the frontend is javascript but for build
and development I use java.

worth it, for me definitely. maybe you find some reasons for you as
well, just give it a trial.

regards, Kristian

On Oct 31, 5:11 pm, MJFuzz <mjaff...@gmail.com> wrote:
> Been a Ruby/Rails developer for about 2 years now. I've had some
> experience developing Java apps a few years back. Mostly command line
> tools to support scheduled tasks...etc. Nothing major.
>
> I've been somewhat curious about JRuby. Anyone using this platform?
> Other than being able to talk to Java via Ruby and vice versa, is
> there any performance gains? Is it really worth it?

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

Ruby on Rails

Been a Ruby/Rails developer for about 2 years now. I've had some
experience developing Java apps a few years back. Mostly command line
tools to support scheduled tasks...etc. Nothing major.

I've been somewhat curious about JRuby. Anyone using this platform?
Other than being able to talk to Java via Ruby and vice versa, is
there any performance gains? Is it really worth it?

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

Ruby on Rails

Thanks for that, but I am still getting a syntax error. Now:-
SQLite3::SQLException: near "%": syntax error: SELECT
"homepages".* FROM "homepages" WHERE (section = %'Gar'%)

This shows that the correct text is being passed, but the syntax is
still incorrect.
Don

On Oct 31, 3:20 am, Sampath Munasinghe <sampathni...@gmail.com> wrote:
> self.where('section = %?%', search_item)
>
> On Sun, Oct 31, 2010 at 7:39 AM, MDM <don.m...@gmail.com> wrote:
> > I am trying to do a search where I can enter a part of a word and the
> > search find all occurrences of that part word in the field. The above
> > subject does not work. Can anyone help
> > I am using Rails 3 and ruby 1.9.2
> > I use to be able to do it in rails 2.x.
> > In my Model I have the following:-
> >  def self.search(search_item)
> >    if search_item
> >     self.where('section = ?', '%:search_item%')
> >    else
> >      self.all
> >    end
> >  end
>
> > In my controller I have:-
> >    @homepages = Homepage.search(params[:search])
> >    respond_to do |format|
> >      format.html # index.html.erb
> >      format.xml  { render :xml => @homepages }
> >      format.js {render :js => @homepages}
> >    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+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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

Ruby on Rails

Thanks for that, but I am still getting a syntax error. Now:-
SQLite3::SQLException: near "%": syntax error: SELECT
"homepages".* FROM "homepages" WHERE (section = %'Gar'%)

This shows that the correct text is being passed, but the syntax is
still incorrect.
Don

On Oct 31, 3:20 am, Sampath Munasinghe <sampathni...@gmail.com> wrote:
> self.where('section = %?%', search_item)
>
> On Sun, Oct 31, 2010 at 7:39 AM, MDM <don.m...@gmail.com> wrote:
> > I am trying to do a search where I can enter a part of a word and the
> > search find all occurrences of that part word in the field. The above
> > subject does not work. Can anyone help
> > I am using Rails 3 and ruby 1.9.2
> > I use to be able to do it in rails 2.x.
> > In my Model I have the following:-
> >  def self.search(search_item)
> >    if search_item
> >     self.where('section = ?', '%:search_item%')
> >    else
> >      self.all
> >    end
> >  end
>
> > In my controller I have:-
> >    @homepages = Homepage.search(params[:search])
> >    respond_to do |format|
> >      format.html # index.html.erb
> >      format.xml  { render :xml => @homepages }
> >      format.js {render :js => @homepages}
> >    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+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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

Ruby on Rails

Thanks for the help.

@Walter - I'll have a look through the comments at the git page to see
if I can find anything about specific paperclip versions working with
rails3 / s3, and the same for aws-s3, thanks for the tip!

@ArailsDemo A. - That turoial looks really good, I'll try and go back
and do the whole thing one day! I have a couple of questions regarding
the paperclip / s3 part.

1. - Your model 'Resources' has the line
t.references :attachable, :polymorphic => true
is this important for being able to attach photos?

2. I'm inputting my photos in a different way, I have the lines:
<%= f.label :photo %>
<%= f.file_field :photo%>
Whereas you have:
= resource_f.input :attachment, :label => 'File'

I've tried substituing your way, and the 'new' page returns the error
undefined method `input' for...

Is this crucial in your setup?

3. I keep coming back to the line
:path => "/:style/:id"
Which in your tutorial is
:path => "/:style/:filename"

Every example seems to have a slightly different line here, what is this
referring to? Is this the structure of me s3 account? is 'style' the
paperclip reference for 'thumb / small / post' etc? Where do you get the
word ':filename' from??

Thanks again for you help, and a great tutroial.

Mike

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

Ruby on Rails

Solution:
Split the migration: The first creats the new column, the second
processes the data.

Looks like problem with migrations.

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

Ruby on Rails

I'm on the same situation, I know both Java and Ruby, and I am looking
for a language that I could use both for administration scripting and
web sites,

I tried a little bit both of Grails and Rails

Rails is easer to use, but it looks like LOTS of plugins/gems are no
more compatibles with the lasts versions of Ruby (1.9.2) and Rails
(3.0.1) (ex: the Qt4 binding for ruby), but I hope this will change with
time :)
Another thing that I don't really like about Rails is that I don't feel
like if I had control on the web stack, most of things are "magic" and I
don't always understand what it does on the background...
But rails has a perfect caching system and clustering way (memcached!),
it's also very easy to profile and debug.
And the most important: There is a HUGE community !

Grails also has some advantages, it's template engine if perfect (GSP)
(I like it really more than ERB, tag based templates are more clean),
and it includes ACEGI (the perfect authentication engine ;p) but the
caching system is really really poor (if not inexistent) and it's harder
to cluster (Terracotta), there is almost nobody on the IRC channel
(nobody speaks or ask questions) and the most important thing: GRAILS
LOVES RAM! (~500MB of RES memory for a simple blank web site
deployment..),
another thing non related to grails, for system scripting, the full
interpreter is really slow to start, and grails don't have access to low
level API like symlinks or chmod things)..
About Java itself, it have the advantages to be the language to use to
extends many big softwares like Zimbra or Alfresco

What do you think about that ?
Thank you

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

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

Ruby on Rails

The way I found to work arround this is to use the Thread.main:

def init
if Thread.main[:uuid] == nil
Thread.main[:uuid]=0
end
uid = Thread.main[:uuid] += 1
render :json => uid
end

http://giladmanor.com/2010/10/rails-application-variable.html

Gilad

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

Ruby on Rails

can you run
$ jruby -S rails server
?
how does your Gemfile look like ?
how do you setup your war files ? with warbler ?

regards, Kristian

On Oct 30, 6:21 am, MJW2529 <mjwhite2...@yahoo.com> wrote:
> Hi,
> I've been trying to get JRuby 1.5.3 with Rails 3 to run on the Tomcat6
> server with little success.
> Has anyone been able to do this?  If so, what issues did you have to
> overcome to get this to work?
> Also, is this a combination that you would recommend for a production
> site, or is it all too new and untested?
> The latest issue I'm stuck on right now is with the mysql-connector-
> java-5.0.4 which comes with jruby 1.5.3 which keeps returning
> JDBCError: Generated keys not requested.
> Any feedback on this would be appreciated.
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Well, I assume, if I want to get a first article by a specific member, I
believe

@article = current_member.articles.first

would work fine.

Then, what should I do if I want to get a first article which has a
category_id of 2, in rails way??

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

Ruby on Rails Saturday, October 30, 2010

Try this

class YourController < ApplicationController
include ActionView::Helpers::SanitizeHelper

def your_action
redirect_to(:back, :notice => sanitize("Photo was successfully
created. Click <a href='#{url_for artist_photo_path(@photo.artist,
@photo)}'>here</a> to view it"))
end
end

If you haven't used the sanitize method before, please read this
http://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-sanitize

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

Ruby on Rails

Well, I've been at this for the past two days.

I'm trying to upgrade a Rails 2.3.2 app (ruby 1.8.7) to rails 3, ruby
1.9.2

I ran across this rails_upgrade plugin and got excited--at first.

However, the installation calls for a ruby script/plugin command, which
does not exist anymore.

I found a post that says to go back to old rails environment to run it.
So I did that. The install does not appear to work as I do not get the
message that the install.rb is supposed to display.

when I try to run the rake rails:upgrade:check I get the message that
rake does not know how to run the task.

I also found that I should update to 2.3.5 first so I tried that. More
problems.

Is there a way I can manually install the rails_upgrade in the rails 3
environment (not using the script/plugin)? It says it should run in
rails 3.

TIA,
Dan

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

Ruby on Rails

Did you set up your S3 bucket for your app?

I wrote up how to do this set up here http://www.arailsdemo.com/posts/15

Hopefully that will get you going.

Michael Baldock wrote in post #958147:
> Thanks for the help Walter, I tried what you said, putting them in a
> different order, still doesn't quite work, although some progress, got a
> different error message now!:
>
> uninitialized constant AWS::S3::NoSuchBucket
>

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

Ruby on Rails

You want to set your comment variable in the controller:

def new
@comment = @post.comments.build
end

so your form is

<%= form_for([@post, @comment]) do |f| %>
<%= render"shared/error_messages", :target => @comment %>
<% end %>


If you build the comment in the form (which you shouldn't be doing
anyways if you're sticking to MVC principles), then when you render the
form, a new comment object is always created. Since it's a new object,
it won't have any errors.

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

Ruby on Rails

self.where('section = %?%', search_item)






On Sun, Oct 31, 2010 at 7:39 AM, MDM <don.mapp@gmail.com> wrote:
I am trying to do a search where I can enter a part of a word and the
search find all occurrences of that part word in the field. The above
subject does not work. Can anyone help
I am using Rails 3 and ruby 1.9.2
I use to be able to do it in rails 2.x.
In my Model I have the following:-
 def self.search(search_item)
   if search_item
    self.where('section = ?', '%:search_item%')
   else
     self.all
   end
 end

In my controller I have:-
   @homepages = Homepage.search(params[:search])
   respond_to do |format|
     format.html # index.html.erb
     format.xml  { render :xml => @homepages }
     format.js {render :js => @homepages}
   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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


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

Ruby on Rails

On Oct 30, 1:53 pm, pepe <P...@BetterRPG.com> wrote:
> Hi all,
>
> Finally starting with git/versionning and would like to know the best
> place(s) where to post my questions (many of them). Already signed up
> athttp://vger.kernel.org/vger-lists.html.

Not where you'd get questions answered but potentially handy:
http://help.github.com/git-cheat-sheets/

Fred

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

Ruby on Rails

pepe wrote in post #958200:
> Hi all,
>
> Finally starting with git/versionning and would like to know the best
> place(s) where to post my questions (many of them). Already signed up
> at http://vger.kernel.org/vger-lists.html.

This should answer most, if not all, of your questions about Git:

http://progit.org/book/

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

Ruby on Rails

I am trying to do a search where I can enter a part of a word and the
search find all occurrences of that part word in the field. The above
subject does not work. Can anyone help
I am using Rails 3 and ruby 1.9.2
I use to be able to do it in rails 2.x.
In my Model I have the following:-
def self.search(search_item)
if search_item
self.where('section = ?', '%:search_item%')
else
self.all
end
end

In my controller I have:-
@homepages = Homepage.search(params[:search])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @homepages }
format.js {render :js => @homepages}
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi all,

I have a rails application at http://electric-sky-98.heroku.com/products

require 'net/http'
require 'uri'
res = Net::HTTP.get_response(URI.parse('http://electric-
sky-98.heroku.com/products.xml'))
puts res.body

the above code gave me the xml file below:

<?xml version="1.0" encoding="UTF-8"?>
<products type="array">
<product>
<brand>Tubers</brand>
<created-at type="datetime">2010-10-30T01:35:48Z</created-at>
<id type="integer">1</id>
<name>Yam</name>
<price>&#163; 30</price>
<quantity>100 tubers</quantity>
<sku>WDW332</sku>
<updated-at type="datetime">2010-10-30T01:35:48Z</updated-at>
</product>
</products>

QUESTION:::
How do i create a new product object at http://electric-sky-98.heroku.com/products
with ruby HTTP POST

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

Ruby on Rails

Thanks i resolved the problem it was a shit that i was programming.

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

Ruby on Rails

On Fri, Oct 29, 2010 at 1:22 PM, Michael Pavling <pavling@gmail.com> wrote:

On 29 October 2010 19:03, David Kahn <dk@structuralartistry.com> wrote:
> Why is Rails looking for a template while I have told it to render a
> specific file? This worked under Rails 2. I read
> http://www.engineyard.com/blog/2010/render-options-in-rails-3/ which from I
> gather makes any format.xxx look for a template xxx which is *not* what I
> need to do as the file is created dynamically:

I think you misunderstand that article.

Looks to me that instead of passing css filenames into the
"ActionController.add_renderer" block, you could just as easily pass
your actual dynamically generated PDF, and then have the "send_data"
call send your file.

Thanks Michael and Rob - you got me through this. The following works:

send_file "#{TEMP_DIRECTORY}/#{comparison.id}_#{params[:view]}.pdf", :stream => false, :type => 'application/pdf', :disposition => 'inline'


But I agree, it's certainly easier the just "render :file => foo_bar"

Right. I know there must be a good reason for a lot of these changes and at some point it will all come together the ponies and rainbows will appear. I am waiting semi-patiently for this moment :)

 
- which I do in some of my controller actions, and I've not moved to
Rails3 yet, so I'll be interested in your result.

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


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

Ruby on Rails

Hello. I'm working very hard to build projects > photo_albums > Photos
But am Stuck on being able to implement it.

Desired User Flow...

#1 - User clicks their project
#2 - User sees a list of photo albums
#3 - Users clicks a Photo Album
#4 - User see a list of photos in the album
#5 - User views the clicked photo BUT has will_paginate showing in
the nav for all the albums photos and will_paginate is defaulted to
the page number of the photo the user clicked

Controllers Based on the Flow Above:
#2 - PhotoAlbum Index
#4 - PhotoAlbum Show
#5 - Photo Show

Routes:
resources :spaces do
resources :photo_albums
resources :photos
end

Does this sound right? Bec I haven't been able to get this working,
and the code is getting ugly :)

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