[Rails] Accessing url_for from a custom helper class ccdaææææøøøæøæ"¥00

2010-12-06 Thread Gudleik Rasch
I have some custom helper classes under lib/ that need to access the routes 
(link_to/url_for/etc): 
http://gist.github.com/520529

But when I call <%= magic_link Product.first %> from the view it renders the 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] ROR and Drupal

2010-12-06 Thread Koteswara rao Vuyyuru
I have a website in Ruby on Rails which is now supposed to be Integrated
with Drupal where the main contents of the page will be served from
Drupal, header and footer will be in ROR. Wanted to know if there is any
API provided in drupal that can access 'Node' contents of the drupal
page directly from ROR page by including an iframe or anything else.

Any help related to it will be good.Thanks in advance!!

Regards
Koteswara Rao.

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

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



[Rails] Re: Render partial generate unwanted spaces

2010-12-06 Thread Julien
On 6 déc, 20:50, Marnen Laibow-Koser  wrote:
> Julien wrote in post #966616:
>
> > On 6 dc, 15:28, Julien  wrote:
> >> > On 6 December 2010 11:03, Julien  wrote:
> >> > >> > text it's fine.
> >> > >> firefox and you can see which div or whatever the space is in and how
> >> > > In Firefox, the generated html seems exactly the same, but in Chrome,
>
> >> Yep, Windows. When i print special chars in Komodo, i see LF ending
> >> each line, but no CR. I'm really not at ease with those file format
> >> issues, can't be really helpful on that, sorry :(
>
> > Confirmation of my second guess:
>
> > It's Komodo Editor, adding ugly stuff.
>
> I use KomodoEdit all the time (on Mac OS, not Windows), and I've never
> seen it do this.  What are your line ending preferences set to (that
> should be somewhere in the status bar)?
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
>
> --
> Posted viahttp://www.ruby-forum.com/.

I tried Scite and converted some CR/LF endings to LF only but it
doesn't correct the issue.
My gut tells me it's not an matter of line endings since the strange
digit appears at the very beggining of the inclusion of the partial
(or the yield). I don't know much about file system but i suppose
Komodo was created on Linux and uses some file headers which are not
correctly understood by Webrick on Windows which then tries to print
them.

I don't have that many partials and will simply recreate them and copy/
paste the code using radrails. I should have guessed that the editor
was to blame before, because i finished a previous full project on
Radrails and never encountered that problem. I switched because
Radrails is a slow when you ctrl+s.

Well i guess the conclusion of all this is that if you encounter
unwanted spaces in your partials, check your editor :)

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



[Rails] Re: HTML5 placeholder attribute and i18n proposal

2010-12-06 Thread Paul Schreiber
On Nov 30, 10:51 am, Peter De Berdt  wrote:

> Should be fairly trivial to add this yourself:
>
> - alias the to_input_field_tag from Rails to to_input_field_tag_old  
> (it's in the InstanceTagMethods module of Rails if I recall correctly)
> - define your own to_input_field_tag
> - all that method needs to do is merge the  
> I18n.t("helpers.placeholder.#{object_name}.#{method_name}") value into  
> the options hash as :placeholder and then call the aliassed  
> to_input_field_tag_old

Thanks for the pointer.

I submitted a patch to to_input_field_tag and attached it to the
ticket:



Paul

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



[Rails] Re: Re: iframe for Ruby on Rails

2010-12-06 Thread Koteswara rao Vuyyuru
Dear Marnen and Colin

   I already said,
 --> I am creating one site using Ruby on Rails Framework.
---> And another one is creating on Drupal Framework.So in my ruby on 
rails site having some features and Drupal site having some features.
-->Finally i am integrate all the features on one framework that is 
drupal Framework.

So finally i want to see all the features in my drupal site for this how 
to put Ruby on Rails Features in Drupal site or how to access Ruby on 
rails application from Drupal site.

Is this information is sufficient for you people.

Thanks & Regards
Koteswara Rao.



Marnen Laibow-Koser wrote in post #966600:
> Colin Law wrote in post #966581:
>> On 6 December 2010 16:40, Marnen Laibow-Koser 
>> wrote:
>>>
 please can anybody help me.
>>>
>>> No, no one can help you with the meager information you provided.
>>> Please be more specific.
>>>
>>
>> I would not hold your breath awaiting enlightenment Marnen.  The OP
>> never responded to repeated requests for clarification on his last
>> request for help on 'calling RoR app from drupal'.
>
> I noticed. :)  But I *do* think he should know why he hasn't got any
> help so far.  What he does with that info is up to him...
>
>>
>> Colin
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

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

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



[Rails] Re: Proper way to back out a bad migration?

2010-12-06 Thread Marnen Laibow-Koser
Rick R wrote in post #966751:
> I'm curious on the best practice to remedy this situation...
>
> I created a habtm migration but forgot the :id => false
>
> I ran the migration (rake db:migrate)
>
> I tried to run my tests and then go the error that made me realize I
> forgot
> the :id => false.
>
> The question is how do I back out my changes?

rake db:rollback (assuming you wrote your down method correctly in the 
migration!).
>

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

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

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



[Rails] Proper way to back out a bad migration?

2010-12-06 Thread Rick R
I'm curious on the best practice to remedy this situation...

I created a habtm migration but forgot the :id => false

I ran the migration (rake db:migrate)

I tried to run my tests and then go the error that made me realize I forgot
the :id => false.

The question is how do I back out my changes?

Typically I do rake db:migrate VERSION=0
But that  also gave me the same error about "Primary key is not allowed in a
has_and_belongs_to_many join table"

So I then fired up dbconsole and manually dropped the table.

But now I even if I run rake db:migrate the join table isn't created -
probably because it 'think' it had run it previously.

I also can't run db:migrate VERSION=0, since it tries to call the drop table
on the table that I manually dropped.

I managed to get things working by commented out my drop_table command in my
migration and then running db:migrate VERSION=0, then doing rake db:migrate
and now I'm ok, but I'd think there would have been easier approach to fix
things?


-- 
Rick R

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



[Rails] Re: Savage Beast plugin + rails 3.0.1

2010-12-06 Thread Arun Kumar
Hi All,

 Why no reply, do i need ask this question to any other forum ? or what
i made mistake here ? Any quick response would make me happy

Thanks Jak.

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

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



[Rails] Re: fields_for and one out of many from association

2010-12-06 Thread pepe
Never mind. I think I got 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok

2010-12-06 Thread CuriousNewbie
Thanks Tim, I tried:

  def check_uri
redirect_to "https://www.mysite.com"; + request.request_uri if !/
^www/.match(request.host) if Rails.env == 'production'
  end

No luck though, Chrome still shows the SSL error when you load
https://mysite.com
It seems to not being taking check_uri in effect early enough.

Any other approaches or ideas? Heroku wasn't able to offer any advice
other than buying a wildcard cert 



On Dec 2, 10:55 am, Tim Shaffer  wrote:
> On Dec 1, 4:44 pm, CuriousNewbie  wrote:
>
> > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs
> > invalid warning?
>
> I have never used Heroku, but couldn't you just use "https://"; in the
> redirect instead of request.protocol?

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



[Rails] fields_for and one out of many from association

2010-12-06 Thread pepe
class Person < ActiveRecord::Base
  has_many :addresses
  has_one :primary_address, :class_name => 'Address', :order =>
'preferred desc, id'

  accepts_nested_attributes_for :addresses, :allow_destroy => true
  accepts_nested_attributes_for :primary_address, :allow_destroy =>
true
end

class Address < ActiveRecord::Base
  belongs_to :person
end

In the view:
<% f.fields_for :primary_address do |address_builder| %>
  <%= render 'addresses', :f => address_builder %>
<% end %>

The 'addresses' table has a boolean column named 'preferred' and there
should be only one address for the person that is the preferred one.

Testing on the console the 'has_one' definition gives me the
'preferred' address if there is one, otherwise it gives me the first
one it finds or returns nil if there are no addresses for the person.
All this is working as expected.

If my association has 2 addresses (I'm making sure one of them is
'preferred' and the other one is not), when the view code runs it does
not output just one address (which is what I need), it outputs 2
addresses, actually the same (preferred) address twice.

Is there a way to make fields_for do what I need it to do?

Thanks in advance.

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Ok, but do you know how to actually erase the old versions of rails. The 
last suggestion did not work as you can see from my terminal session.

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966708:
[...]
> Just a note about the 'what you wants'. I don't know if it will be
> your case but I'm not a native English speaker and when I first talked
> to native speakers it bothered me a lot the 'no, what you want is...',
> then I realized that it's just their way of saying 'what you probably
> should do is...', or I take it that way. It has never bothered me
> since I saw it that way.

Yes, that's how I meant it.  Sorry for any misunderstanding.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

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

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



[Rails] Re: Handling File on Upload

2010-12-06 Thread spncrgr
sorry...that was the wrong URL for the second pastie.  Here's the
right one: http://www.pastie.org/1354138

On Dec 6, 8:02 pm, spncrgr  wrote:
> Thanks, Vladimir and David for your replies.
>
> I did experiment with Paperclip without much success.  I look at the
> post Vladimir linked to and that gave me the idea to create a custom
> processor.  It didn't work though.  No errors thrown, but no records
> saved either :-/
>
> I'm sure I did it wrong, but here's the code:http://www.pastie.org/1354053
>
> I also experimented with taking Paperclip out of the picture and put
> the code to create the records in the controller.  What I get now is
> an error that says "invalid attribute".  The invalid attribute
> provided is the first email address of the first line of the file.
>
> Here's that code:  http://www.pastie.org/1354053
>
> Thanks again for any and all help.  This has been my largest hurdle to
> overcome in Rails thus far.
>
> -S
>
> On Dec 6, 4:01 pm, David Kahn  wrote:
>
>
>
> > On Mon, Dec 6, 2010 at 1:47 PM, Vladimir Rybas 
> > wrote:
>
> > > I recommend you to use Paperclip for files uploading.
> > >http://railscasts.com/episodes/134-paperclip
>
> > The only thing if I recall, that kept me from using paperclip for my
> > purposes, is the file essentially attached to the model but does not allow
> > for modification and re-saving the file --- am I mistaken? Unless things
> > have changed recently, it would be super-cool if Paperclip would handle file
> > mods just as a mod to any attribute of the model... although I guess this
> > gets away from the basic intent of Paperclip, which for what it does do does
> > it very nicely.
>
> > > Besides it's other awesome features, you want to use Paperclip
> > > Processors to play with a file after upload.
>
> > >http://mdeering.com/posts/018-paperclip-processors-doing-so-much-more...
>
> > > To read file lines you can go for
>
> > > File.readlines(@file.path).collect(&:chomp).each do |line|
> > >  ... (create your models here)
> > > end
>
> > > to collect all lines.
> > > `chomp` will cut end-of-line symbols, and @file it's an object which
> > > is given by Paperclip.
> > > Or if you have troubles with this one, here's another option
>
> > > IO.foreach("path/to/file.txt") do |line|
> > >  ... (create your models here)
> > > end
>
> > > On Mon, Dec 6, 2010 at 5:54 AM, spncrgr  wrote:
> > > > Hello,
>
> > > > I need some help trying to figure out how to add the ability for a
> > > > user to upload a text file, and then have the application parse that
> > > > text file, and add each record as instance of a model object.  I've
> > > > found a lot of helpful articles out there, but I'm stuck trying to
> > > > bring it all together since I'm still very new to all of this.
>
> > > > Here's my view code:
> > > > # index.html.erb
> > > > <% form_for :upload, :url => { :action => :upload }, :html =>
> > > > { :multipart => true } do |f| %>
>
> > > >    Please select a file to upload:
> > > >    <%= f.file_field :file %>
> > > >    <%= f.submit 'Upload', :disable_with => "Uploading..." %>
>
> > > > <% end %>
>
> > > > In my controller, I've been able to write something like this to work
> > > > with the data in my upload view:
>
> > > > # mailing_lists_controller.rb
> > > > def upload
> > > >    file = params[:upload][:file]
> > > >   �...@data = file.read
> > > >  end
>
> > > > so then the view looks like this:
> > > > # upload.html.erb
> > > > <% @data.split("\r\n").each do |row| %>
>
> > > >    <%= row.split("\t").join(" | ") %>
>
> > > > <% end %>
>
> > > > So, where I'm stuck is translating that into saving each row as a
> > > > record in the database.  I've tried several different things in the
> > > > model (like creating a "process" method or using "before_save"), but
> > > > nothing has been successful thus far (probably because I'm not
> > > > implementing it correctly).
>
> > > > Any help would be appreciated.
>
> > > > Thanks,
> > > > Spencer
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > "Ruby on Rails: Talk" group.
> > > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com > >  e...@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-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com > >  e...@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 t

[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Thanks pepe,


RobsMacAir:~ rob$ rails -v
Rails 2.3.8
RobsMacAir:~ rob$ gem uninstall my_gem -v=2.3.8
ERROR:  While executing gem ... (Gem::InstallError)
Unknown gem my_gem = 2.3.8
RobsMacAir:~ rob$

??

I want to uninstall everything besides 2.2.2

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

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



[Rails] Re: Handling File on Upload

2010-12-06 Thread spncrgr
Thanks, Vladimir and David for your replies.

I did experiment with Paperclip without much success.  I look at the
post Vladimir linked to and that gave me the idea to create a custom
processor.  It didn't work though.  No errors thrown, but no records
saved either :-/

I'm sure I did it wrong, but here's the code: http://www.pastie.org/1354053

I also experimented with taking Paperclip out of the picture and put
the code to create the records in the controller.  What I get now is
an error that says "invalid attribute".  The invalid attribute
provided is the first email address of the first line of the file.

Here's that code:  http://www.pastie.org/1354053


Thanks again for any and all help.  This has been my largest hurdle to
overcome in Rails thus far.

-S

On Dec 6, 4:01 pm, David Kahn  wrote:
> On Mon, Dec 6, 2010 at 1:47 PM, Vladimir Rybas wrote:
>
> > I recommend you to use Paperclip for files uploading.
> >http://railscasts.com/episodes/134-paperclip
>
> The only thing if I recall, that kept me from using paperclip for my
> purposes, is the file essentially attached to the model but does not allow
> for modification and re-saving the file --- am I mistaken? Unless things
> have changed recently, it would be super-cool if Paperclip would handle file
> mods just as a mod to any attribute of the model... although I guess this
> gets away from the basic intent of Paperclip, which for what it does do does
> it very nicely.
>
>
>
>
>
> > Besides it's other awesome features, you want to use Paperclip
> > Processors to play with a file after upload.
>
> >http://mdeering.com/posts/018-paperclip-processors-doing-so-much-more...
>
> > To read file lines you can go for
>
> > File.readlines(@file.path).collect(&:chomp).each do |line|
> >  ... (create your models here)
> > end
>
> > to collect all lines.
> > `chomp` will cut end-of-line symbols, and @file it's an object which
> > is given by Paperclip.
> > Or if you have troubles with this one, here's another option
>
> > IO.foreach("path/to/file.txt") do |line|
> >  ... (create your models here)
> > end
>
> > On Mon, Dec 6, 2010 at 5:54 AM, spncrgr  wrote:
> > > Hello,
>
> > > I need some help trying to figure out how to add the ability for a
> > > user to upload a text file, and then have the application parse that
> > > text file, and add each record as instance of a model object.  I've
> > > found a lot of helpful articles out there, but I'm stuck trying to
> > > bring it all together since I'm still very new to all of this.
>
> > > Here's my view code:
> > > # index.html.erb
> > > <% form_for :upload, :url => { :action => :upload }, :html =>
> > > { :multipart => true } do |f| %>
>
> > >    Please select a file to upload:
> > >    <%= f.file_field :file %>
> > >    <%= f.submit 'Upload', :disable_with => "Uploading..." %>
>
> > > <% end %>
>
> > > In my controller, I've been able to write something like this to work
> > > with the data in my upload view:
>
> > > # mailing_lists_controller.rb
> > > def upload
> > >    file = params[:upload][:file]
> > >   �...@data = file.read
> > >  end
>
> > > so then the view looks like this:
> > > # upload.html.erb
> > > <% @data.split("\r\n").each do |row| %>
>
> > >    <%= row.split("\t").join(" | ") %>
>
> > > <% end %>
>
> > > So, where I'm stuck is translating that into saving each row as a
> > > record in the database.  I've tried several different things in the
> > > model (like creating a "process" method or using "before_save"), but
> > > nothing has been successful thus far (probably because I'm not
> > > implementing it correctly).
>
> > > Any help would be appreciated.
>
> > > Thanks,
> > > Spencer
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com > e...@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-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com > e...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread pepe
To uninstall a gem version you have 2 options:

a) Declare the version at the end of the uninstall command: gem
uninstall my_gem -v=x.x.x (You replace the 'x.x.x' with the version
you want to remove, OR
b) Run the uninstall command without version specified: gem uninstall
my_gem

Option b) will prompt you which version you want to remove out of all
the versions you have loaded but if you only have one version it will
go ahead and remove just that one without asking.

Just a note about the 'what you wants'. I don't know if it will be
your case but I'm not a native English speaker and when I first talked
to native speakers it bothered me a lot the 'no, what you want is...',
then I realized that it's just their way of saying 'what you probably
should do is...', or I take it that way. It has never bothered me
since I saw it that way.

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



[Rails] select helpet selected value after failed save

2010-12-06 Thread Patricio Bruna
I have a nested form, like:

<% form_for @invoice do |f| %>
 <%= render :partial => "invoice_item_fields", :locals => {:f => f} %>
<% end %>

and _invoice_items_fields:

<% f.fields_for :invoice_items do |builder| %>
 <%= link_to_remove_fields "remove", builder %>
 <%= builder.collection_select(:product_id, Product.all, :id, :name) %>
 <%= builder.text_field :quantity, :size => 4,%>
<% end %>


When i submit the form and it not pass the validations it render the new
action again. The thing is the selected value for :product_id is no
remembered, but the :quantity is ok. I read that i should setup an
instance variable in the controller with the value of the selected
option and then do something like:

<%= builder.collection_select(:product_id, Product.all, :id, :name,
:selected => @selected_product) %>

but the thing is the application could have many :invoice_items, so i
don't know what to do for the select field "remember" the values.

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



Re: [Rails] Handling File on Upload

2010-12-06 Thread David Kahn
On Mon, Dec 6, 2010 at 3:59 PM, Walter Lee Davis  wrote:

>
> On Dec 6, 2010, at 4:01 PM, David Kahn wrote:
>
>  The only thing if I recall, that kept me from using paperclip for my
>> purposes, is the file essentially attached to the model but does not allow
>> for modification and re-saving the file --- am I mistaken? Unless things
>> have changed recently, it would be super-cool if Paperclip would handle file
>> mods just as a mod to any attribute of the model... although I guess this
>> gets away from the basic intent of Paperclip, which for what it does do does
>> it very nicely.
>>
>
>
> You are mistaken, and although I came late to the Paperclip party, I can't
> recall a time when it was true. You can edit the model without modifying the
> image (just don't upload another image) and everything stays the same in the
> image, or you can upload a new image and it will overwrite the previous
> version. It's all managed when you save the model that the image is attached
> to.
>

Right, but what I wanted was to be able to load a model instance, change the
file (say I encrypt a portion of the text) and have Paperclip update that
file on its own when I call model#save. I am pretty sure Paperclip does not
do this. Right, you can re-save the file but it requires manual action
beyond calling model#save.

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

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



[Rails] Re: Uninstalling RoR form a Mac

2010-12-06 Thread Rob Th
If I asked you how to get to gramma house you would say use a car.

Leave me alone.

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Give me a break.

I asked a question.

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

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



[Rails] Re: Uninstalling RoR form a Mac

2010-12-06 Thread Marnen Laibow-Koser
Rob Th wrote in post #966692:
> I tried using rvm and completely messed things up. I want to delete all
> versions of rails from this Mac (Snow Leopard) and install rails 2.2.2.
> Only.
>
> I have ruby 1.8.7.

You install and remove Rails like any other gem.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Marnen Laibow-Koser
For the third time, please quote when replying.

Rob Th wrote in post #966691:
> PLEASE, do not tell me what I want, I WANT to get rid of all versions of
> rails besides 2.2.2.
>
> This is the infuriating thing about RoR. People tell me what I want when
> I tell them what I want and what they want me to want is not want I
> want. jeez.

You yourself said you're new to Ruby and Rails.  Please try to 
understand the usual Ruby and Rails ways of doing things before you 
decide to do things differently.  That means understanding how to manage 
gems properly, not just deleting things you don't understand.

You posted here asking for advice.  Don't ignore the advice you're 
getting because it isn't exactly what you wanted to hear.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Uninstalling RoR form a Mac

2010-12-06 Thread Rob Th
I tried using rvm and completely messed things up. I want to delete all
versions of rails from this Mac (Snow Leopard) and install rails 2.2.2.
Only.

I have ruby 1.8.7.

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
PLEASE, do not tell me what I want, I WANT to get rid of all versions of 
rails besides 2.2.2.

This is the infuriating thing about RoR. People tell me what I want when 
I tell them what I want and what they want me to want is not want I 
want. jeez.

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Marnen Laibow-Koser
Please quote when replying!

Rob Th wrote in post #966685:
> Sorry, I interpreted you remarks as "switch" back and forth. I want to
> 'blow away' -  remove - delete all rails except 2.2.2.
>
> "RVM also lets you switch between different gemsets" usually means
> switch between.

Yes.  It's usually best to have a separate gemset for each Rails 
application.  That way, each application sees only the gems it needs.

> I just want one version.

No, you probably want one version *per application*.

> I still think rvm is confusing.

It's a lot less confusing that any of the other gem management solutions 
I'm aware of.  Try it!

>
> Ok, so how do I use rvm to remove the other versions of rails from Macs?

You don't need to.  Just declare a gemset that doesn't include the gems 
you don't want.

> Or is there a another way?

Well, you needn't usually worry too much.  Gems are designed so that 
multiple versions can coexist, and Rails applications pick the version 
they want in the environment.rb file.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Sorry, I interpreted you remarks as "switch" back and forth. I want to 
'blow away' -  remove - delete all rails except 2.2.2.

Ok, so how do I use rvm to remove the other versions of rails from Macs?

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

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



[Rails] Re: render :json not setting content type (Rails 3.0.3)

2010-12-06 Thread Pete Deffendol
It took a little while longer, but I found a supposedly undocumented
gotcha in Rails 3 that was causing my problem.

The controller in question had a private method "content_type"
defined.  Apparently that method is already defined for controllers,
and overriding it was causing the problem with the MIME type.  So,
don't define a content_type method in your controller.

On Dec 3, 12:26 pm, Pete Deffendol  wrote:
> Hi,
>
> I'm experiencing a strange problem on an application this is in the
> process of being converted from Rails 2.3 to 3.0.3.  I have several
> controllers that are rendering either HTML or JSON depending on the
> requested format, using respond_to:

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



[Rails] Re: Best way to do testing / load seed data?

2010-12-06 Thread Marnen Laibow-Koser
daze wrote in post #966672:
> What is the preferred way to have testing data - fixtures, or
> something like factory_girl (https://github.com/thoughtbot/
> factory_girl)?

Factories.  Never use fixtures, ever, for anything.

>
> I definitely need something that can handle relationships between
> things - for example, an article belongs to a section / a section has
> many articles.

If you had checked the documentation for Factory Girl and Machinist, you 
would know that they can do this.

>
> Also, how do people generally load seed data?  I know about rake
> db:seed...but do people generally load something (like fixtures) in
> the seeds.rb file instead of typing out all this stuff in there?
> There must be a clean way to handle all of this!

There is.  The seeds.rb file or the seed_fu plugin.

>
> I think I'm going to try factory_girl if no one has major objections...

Yes, do try that or Machinist.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Marnen Laibow-Koser
Please quote when replying.

Rob Th wrote in post #98:
> Phew, this is getting even more confusing. Why do I "want to switch
> between gemsets".
>

So that you can have your Ruby interpreter see only the gems you want it 
to see.

> I want the version of rail on my Mac to match the Ubuntu which is 2.2.2!
>
> I want the other versions of rails to go bye-bye. How do I do that?

By using RVM or Bundler.  Take your pick.  (There are other ways, but 
those tools make life simpler than the other options.)

>
> Why would your *think* I want to switch?

Because that's exactly what you're saying you want.  You've said "I want 
my Rails application to see these particular gems, and no others". 
That's basically the definition of a defined gemset.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Best way to do testing / load seed data?

2010-12-06 Thread daze
What is the preferred way to have testing data - fixtures, or
something like factory_girl (https://github.com/thoughtbot/
factory_girl)?

I definitely need something that can handle relationships between
things - for example, an article belongs to a section / a section has
many articles.

Also, how do people generally load seed data?  I know about rake
db:seed...but do people generally load something (like fixtures) in
the seeds.rb file instead of typing out all this stuff in there?
There must be a clean way to handle all of this!

I think I'm going to try factory_girl if no one has major objections...

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



Re: [Rails] Handling File on Upload

2010-12-06 Thread Walter Lee Davis


On Dec 6, 2010, at 4:01 PM, David Kahn wrote:

The only thing if I recall, that kept me from using paperclip for my  
purposes, is the file essentially attached to the model but does not  
allow for modification and re-saving the file --- am I mistaken?  
Unless things have changed recently, it would be super-cool if  
Paperclip would handle file mods just as a mod to any attribute of  
the model... although I guess this gets away from the basic intent  
of Paperclip, which for what it does do does it very nicely.



You are mistaken, and although I came late to the Paperclip party, I  
can't recall a time when it was true. You can edit the model without  
modifying the image (just don't upload another image) and everything  
stays the same in the image, or you can upload a new image and it will  
overwrite the previous version. It's all managed when you save the  
model that the image is attached to.


Walter

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Phew, this is getting even more confusing. Why do I "want to switch 
between gemsets".

I want the version of rail on my Mac to match the Ubuntu which is 2.2.2!

I want the other versions of rails to go bye-bye. How do I do that?

Why would your *think* I want to switch?

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

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



Re: [Rails] Re: saving attachment and images to database

2010-12-06 Thread Rajinder Yadav
On Mon, Dec 6, 2010 at 2:59 PM, Marnen Laibow-Koser
 wrote:
> Rajinder Yadav wrote in post #966402:
>> How can I upload an attachment and store it into a database as a binary
>> blob object?
> [...]
>
> Don't.  Keep binary data in the filesystem.  That way you won't have to
> invoke Rails every time you want to serve a file, and your database will
> be easier to maintain.
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

Marnen,

you got a valid point, that didn't cross my mind.
Thanks!

-- 
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

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



[Rails] Re: incompatible character encodings: ASCII-8BIT and UTF-8

2010-12-06 Thread Marnen Laibow-Koser
Robert K. wrote in post #966327:
> Hallo all,
>>Marnen Laibow-Koser wrote in post #965696:
>> Git exists in Windows.
> Yes, but I don't know to work with it

Learn.

> and therefore I cannot imagine,
> how to update the core of rails without not to break it ):

I note that you conveniently neglected to quote my point that a 
*nix-style patch tool also probably exists for Windows.  That or Git 
will apply a patchfile very nicely indeed.

>
>> but why are you torturing yourself with Windows? :)
> Well, most of my job I make on MS Excel tables with VBA support. Now I
> am trying to move to Rails, but it does not work yet... Maybe in some
> months I will be not more dependent on Bill's products (:

Start now!  Use a *nix VM for Rails development.  I understand Virtual 
Rails is nice.

[...]
> This is to much complicated for me to solve.

Well, stop complicating things further by using Windows!

>
> Robert

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Marnen Laibow-Koser
Rob Th wrote in post #90:
> Thanks. I found the rvm and installed it. I think...
>
> iMac:~ uxxx$ rvm gemdir
> /Library/Ruby/Gems/1.8
>
> But this is sooo confusing. I do not think this is what I want.

But you are probably wrong.

> I do not
> want to switch around from different ruby versions. In fact, the version
> I have on my iMac is the same as the one on my Ubuntu server. 1.8.7

But RVM also lets you switch between different gemsets, which *is* what 
you want.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
Hassan Schroeder wrote in post #966658:
> On Mon, Dec 6, 2010 at 6:44 AM, Marnen Laibow-Koser
>  wrote:
>
> Not specific to Windows, but...
>
>> Investigate JRuby and Glassfish.
>
> The Glassfish app server 1) is way overkill for a JRuby/Rails app
> and 2) doesn't officially support JRuby any more. And the Glassfish
> gem is no longer under development.

Oh, that's too bad.  I had the impression (though I've never used it) 
that the Glassfish gem in particular was amazing.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
Thanks. I found the rvm and installed it. I think...

iMac:~ uxxx$ rvm gemdir
/Library/Ruby/Gems/1.8

But this is sooo confusing. I do not think this is what I want. I do not
want to switch around from different ruby versions. In fact, the version
I have on my iMac is the same as the one on my Ubuntu server. 1.8.7


I would be happy to just delete the old and newer versions of rails and
just keep the 2.2.2 version.

I don't think I need the tricked-out rvm.

Can you help me figure out how to remove the other versions of Rails?

R

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

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



Re: [Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Hassan Schroeder
On Mon, Dec 6, 2010 at 6:44 AM, Marnen Laibow-Koser
 wrote:

Not specific to Windows, but...

> Investigate JRuby and Glassfish.

The Glassfish app server 1) is way overkill for a JRuby/Rails app
and 2) doesn't officially support JRuby any more. And the Glassfish
gem is no longer under development.

If you want to use JRuby look at Tomcat or the Trinidad (embedded
Tomcat) gem.  (There's also a Jetty-based gem but I haven't used it
and don't know how actively it's being maintained.)

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



Re: [Rails] Emacs tips

2010-12-06 Thread Walter McGinnis
It's worth noting the "emacs starter kit" stuff on github.

https://github.com/search?type=Everything&language=&q=emacs+starter

I've got an Aquamacs flavored one (there are some forks of it, too),
listed there.  It's based on other Rubyists starter kits that are more
".emacs" based.

Cheers,
Walter

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



Re: [Rails] Handling File on Upload

2010-12-06 Thread David Kahn
On Mon, Dec 6, 2010 at 1:47 PM, Vladimir Rybas wrote:

> I recommend you to use Paperclip for files uploading.
> http://railscasts.com/episodes/134-paperclip
>

The only thing if I recall, that kept me from using paperclip for my
purposes, is the file essentially attached to the model but does not allow
for modification and re-saving the file --- am I mistaken? Unless things
have changed recently, it would be super-cool if Paperclip would handle file
mods just as a mod to any attribute of the model... although I guess this
gets away from the basic intent of Paperclip, which for what it does do does
it very nicely.


>
> Besides it's other awesome features, you want to use Paperclip
> Processors to play with a file after upload.
>
> http://mdeering.com/posts/018-paperclip-processors-doing-so-much-more-with-your-attachment
>
> To read file lines you can go for
>
> File.readlines(@file.path).collect(&:chomp).each do |line|
>  ... (create your models here)
> end
>
> to collect all lines.
> `chomp` will cut end-of-line symbols, and @file it's an object which
> is given by Paperclip.
> Or if you have troubles with this one, here's another option
>
> IO.foreach("path/to/file.txt") do |line|
>  ... (create your models here)
> end
>
>
> On Mon, Dec 6, 2010 at 5:54 AM, spncrgr  wrote:
> > Hello,
> >
> > I need some help trying to figure out how to add the ability for a
> > user to upload a text file, and then have the application parse that
> > text file, and add each record as instance of a model object.  I've
> > found a lot of helpful articles out there, but I'm stuck trying to
> > bring it all together since I'm still very new to all of this.
> >
> > Here's my view code:
> > # index.html.erb
> > <% form_for :upload, :url => { :action => :upload }, :html =>
> > { :multipart => true } do |f| %>
> >
> >Please select a file to upload:
> ><%= f.file_field :file %>
> ><%= f.submit 'Upload', :disable_with => "Uploading..." %>
> >
> > <% end %>
> >
> > In my controller, I've been able to write something like this to work
> > with the data in my upload view:
> >
> > # mailing_lists_controller.rb
> > def upload
> >file = params[:upload][:file]
> >@data = file.read
> >  end
> >
> > so then the view looks like this:
> > # upload.html.erb
> > <% @data.split("\r\n").each do |row| %>
> >
> ><%= row.split("\t").join(" | ") %>
> >
> > <% end %>
> >
> >
> > So, where I'm stuck is translating that into saving each row as a
> > record in the database.  I've tried several different things in the
> > model (like creating a "process" method or using "before_save"), but
> > nothing has been successful thus far (probably because I'm not
> > implementing it correctly).
> >
> > Any help would be appreciated.
> >
> > Thanks,
> > Spencer
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
Michael Pavling wrote in post #966651:
[...]
>> To make the whole picture "even better" the client will not only use
>> Windows but MSSQL as well
>
> Excuse my abruptness, but what on Earth are they using Rails for then?

Rails actually works well with MSSQL, as I and many others can attest. 
But we're not trying to run Rails on Windows...

> And who is making these (erroneous) technical decisions?

I'd worry more about that.

> Sounds like an ideal environment for a .Net application.

Doesn't it?

> I'm with Marnen... run away from them :-/

:)

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



Re: [Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Michael Pavling
On 6 December 2010 19:23, pepe  wrote:
>> Many will dis it but I have found Instant Rails well suited to exactly
>
> I had not thought about IR but it actually would not work in this
> case, I think.

They "dis" it when people suggest deploying apps with it, because it's
a development platform with no security and poor management ability.
If you *have* to use Rails on Windows, either set it up manually or
use the Bitnami RubyStack.

> To make the whole picture "even better" the client will not only use
> Windows but MSSQL as well

Excuse my abruptness, but what on Earth are they using Rails for then?
And who is making these (erroneous) technical decisions?
Sounds like an ideal environment for a .Net application.
I'm with Marnen... run away from them :-/

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966645:
>> Then do what we're doing here: use a separate *nix server for the Rails
>> app, and connect with TinyTds. That way Rails and MSSQL both get the
>> environment in which they're happiest.
>
> That's exactly the idea I had in mind but... it was not well received.

Some clients are not worth working for.  Keep that in mind.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread pepe
> Then do what we're doing here: use a separate *nix server for the Rails
> app, and connect with TinyTds.  That way Rails and MSSQL both get the
> environment in which they're happiest.

That's exactly the idea I had in mind but... it was not well received.

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



[Rails] Re: saving attachment and images to database

2010-12-06 Thread Marnen Laibow-Koser
Rajinder Yadav wrote in post #966402:
> How can I upload an attachment and store it into a database as a binary
> blob object?
[...]

Don't.  Keep binary data in the filesystem.  That way you won't have to 
invoke Rails every time you want to serve a file, and your database will 
be easier to maintain.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



Re: [Rails] Re: saving attachment and images to database

2010-12-06 Thread Rajinder Yadav
On Mon, Dec 6, 2010 at 3:22 AM, Atheeq P.  wrote:
> Rajinder Yadav wrote in post #966402:
>> How can I upload an attachment and store it into a database as a binary
>> blob object?
>>
>> Also if I (file) upload an image and I resize and create thumbnails, how
>> do I save these images into a database.
>>
>> --
>> Kind Regards,
>> Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely
>>
>> GNU/Linux: 2.6.35-22-generic
>> Kubuntu x86_64 10.10 | KDE 4.5.1
>> Ruby 1.9.2p0 | Rails 3.0.1
>
>
> Hello Rajinder,
>
> We have a plugin in rails which does exactly this job, it creates
> thumbnails too. I have implemented this in my two projects. Please
> follow this steps
>
> http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/
>

Hi Atheeq,

I fiddled with paperclip in the past, but from what I can see the
image uploaded are being save to file, not the database.

-- 
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966625:
[...]
> To make the whole picture "even better" the client will not only use
> Windows but MSSQL as well, which is how the whole mess started
> actually (ODBC problems).

Then do what we're doing here: use a separate *nix server for the Rails 
app, and connect with TinyTds.  That way Rails and MSSQL both get the 
environment in which they're happiest.

If you can't do that, JRuby and jTDS might work, or you could use MRI 
and ODBC.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Render partial generate unwanted spaces

2010-12-06 Thread Marnen Laibow-Koser
Julien wrote in post #966616:
> On 6 dc, 15:28, Julien  wrote:
>> > On 6 December 2010 11:03, Julien  wrote:
>> > >> > text it's fine.
>> > >> firefox and you can see which div or whatever the space is in and how
>> > > In Firefox, the generated html seems exactly the same, but in Chrome,
>>
>> Yep, Windows. When i print special chars in Komodo, i see LF ending
>> each line, but no CR. I'm really not at ease with those file format
>> issues, can't be really helpful on that, sorry :(
>
> Confirmation of my second guess:
>
> It's Komodo Editor, adding ugly stuff.

I use KomodoEdit all the time (on Mac OS, not Windows), and I've never 
seen it do this.  What are your line ending preferences set to (that 
should be somewhere in the status bar)?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Mark Lohstroh
Marnen Laibow-Koser wrote in post #966636:

> It may be, but the OP is asking a different question.

Yes i am, and i'm using a different gem called Koala.
https://github.com/arsduo/koala
I wanted something a bit easier to work with than facebooker.  the only
downside to koala is that it makes you do some things manually. Which is
why i need facebook's javascript SDK.

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

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Marnen Laibow-Koser
Please quote when replying.

Zoltan Gero wrote in post #966633:
> Hello Mark,
> I think Facebooker is your choice:
>
> Find it here: https://github.com/mmangino/facebooker
[...]

It may be, but the OP is asking a different question.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



Re: [Rails] Handling File on Upload

2010-12-06 Thread Vladimir Rybas
I recommend you to use Paperclip for files uploading.
http://railscasts.com/episodes/134-paperclip

Besides it's other awesome features, you want to use Paperclip
Processors to play with a file after upload.
http://mdeering.com/posts/018-paperclip-processors-doing-so-much-more-with-your-attachment

To read file lines you can go for

File.readlines(@file.path).collect(&:chomp).each do |line|
 ... (create your models here)
end

to collect all lines.
`chomp` will cut end-of-line symbols, and @file it's an object which
is given by Paperclip.
Or if you have troubles with this one, here's another option

IO.foreach("path/to/file.txt") do |line|
 ... (create your models here)
end


On Mon, Dec 6, 2010 at 5:54 AM, spncrgr  wrote:
> Hello,
>
> I need some help trying to figure out how to add the ability for a
> user to upload a text file, and then have the application parse that
> text file, and add each record as instance of a model object.  I've
> found a lot of helpful articles out there, but I'm stuck trying to
> bring it all together since I'm still very new to all of this.
>
> Here's my view code:
> # index.html.erb
> <% form_for :upload, :url => { :action => :upload }, :html =>
> { :multipart => true } do |f| %>
>
>    Please select a file to upload:
>    <%= f.file_field :file %>
>    <%= f.submit 'Upload', :disable_with => "Uploading..." %>
>
> <% end %>
>
> In my controller, I've been able to write something like this to work
> with the data in my upload view:
>
> # mailing_lists_controller.rb
> def upload
>    file = params[:upload][:file]
>   �...@data = file.read
>  end
>
> so then the view looks like this:
> # upload.html.erb
> <% @data.split("\r\n").each do |row| %>
>
>    <%= row.split("\t").join(" | ") %>
>
> <% end %>
>
>
> So, where I'm stuck is translating that into saving each row as a
> record in the database.  I've tried several different things in the
> model (like creating a "process" method or using "before_save"), but
> nothing has been successful thus far (probably because I'm not
> implementing it correctly).
>
> Any help would be appreciated.
>
> Thanks,
> Spencer
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] Re: Render partial generate unwanted spaces

2010-12-06 Thread Steve Spiller
if it's the adding of cr/lf, try scite - it has the ability to specify and
convert eol to and from cr, cr/lf, or lf. A bit of a pain to do manually,
but I dn't know how to do automatically.

On 6 December 2010 18:45, Julien  wrote:

> On 6 déc, 15:28, Julien  wrote:
> > On 6 déc, 12:30, Colin Law  wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > On 6 December 2010 11:03, Julien  wrote:
> >
> > > > On 6 déc, 09:53, Colin Law  wrote:
> > > >> On 5 December 2010 22:44, Julien  wrote:
> >
> > > >> > exact same poltergeist for me on rails 3.0.1 and ruby 1.9.2. It
> adds
> > > >> > some visible space in browser but completely invisible in the
> > > >> > generated HTML.
> >
> > > >> > it seems to be when the partial starts by a tag (like " ...>").
> > > >> > It's not a space but a linebreak. If partial starts by basic
> simple
> > > >> > text it's fine.
> > > >> > I checked my ruby source files encoding and it's plain good utf8.
> >
> > > >> > The generated html may look exactly the same using 'source>view'
> in
> > > >> > both cases but i'm wondering if there might be some fancy digits
> > > >> > making this linebreak.
> >
> > > >> If the html (and javascript and css) are the same then it must
> render
> > > >> the same, that is all the browser has to go on.  Copy and paste the
> > > >> html into a text file for each case and then do a file compare.
>  Also
> > > >> if you want to see where the extra space is coming from use firebug
> in
> > > >> firefox and you can see which div or whatever the space is in and
> how
> > > >> the area is styled.
> >
> > > >> I note that the OP was not heard from again after he was asked to
> > > >> check the generated html in this way (with the request re-inforced
> by
> > > >> Marnen as it appeared he may not have understood that it was the
> html
> > > >> that was to be compared).
> >
> > > >> Colin
> >
> > > > Hi ! Thanks for reply, i have news:
> > > > In Firefox, the generated html seems exactly the same, but in Chrome,
> > > > i can see an extra-digit.
> > > > Screen:
> http://lh4.ggpht.com/_Hc_PJsJ5czI/TPy9KFd3RsI/AAABNIc/bApGqfK32fE...
> >
> > > Well I have to apologise for suggesting that if the html looked the
> > > same then it would render the same.  I had not allowed for
> > > non-displaying characters.  I wonder whether you are on developing on
> > > windows?  I seem to remember a problem with <%-  -%> that the -
> > > removed the LF but not the CR in files with CRLF line endings.
> >
> > > Colin
> >
> > Yep, Windows. When i print special chars in Komodo, i see LF ending
> > each line, but no CR. I'm really not at ease with those file format
> > issues, can't be really helpful on that, sorry :(
>
> Confirmation of my second guess:
>
> It's Komodo Editor, adding ugly stuff.
> I've open and added some files in the projects using Radrails and
> everything is okay.
> Though i have no way to correct files corrupted by Komodo (open and
> save doesn't do the trick).
> Damn Komodo!!! And maybe some other text-editors generate the same
> kind of horror.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread gezope
Hello Mark,
I think Facebooker is your choice:

Find it here: https://github.com/mmangino/facebooker

The API documentation: http://facebooker.rubyforge.org/

Some tutorials on it: https://github.com/digidigo/facebooker-tutorial

Check this: http://apps.facebook.com/facebooker_tutorial/ (for me
currently it's not working...)

Important: wanted to buy a book about if from PragProg, but they said
it ouf of date, so don't buy it! ;)

Write me in private, if you find other/better resource, I'm also
interested in it.
Good luck,
Zoltán

On Dec 6, 4:11 am, Mark Lohstroh  wrote:
> Hey, i'm trying to add the facebook javascript SDK  to my rails app. How
> do i do that in the application.html.erb file?
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Robert Walker
Rob Th wrote in post #966620:
> I am extremely new to RoR, I am. I am slowly but surely learning Ruby
> and the Rails concepts but the environment is confusing.
>
> I have an application that was written for my company in RoR. It is on a
> ubuntu server that is going to be shut down. I want to move the app to
> my two Macs (one Leopard and one Snow Leopard). We want to keep the app
> to demo a business concept but it can run locally exclusively
> (localhost).  So I want to move it to my Macs from the shared Ubuntu
> server. I am concerned about Rails and Ruby backwards compatibility; and
> if there are any particular sand traps please let me know. Also why does
> gem list --local seem to indicate the Macs have multiple versions? Is
> this bad? And what should I do to insure I have compatible Mac RoRs for
> running the app.

Use RVM and setup exactly the same environment that is currently on the 
Ubuntu box and all should be well with the world:

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



[Rails] Re: Re: testing chapter: agile web dev withrails

2010-12-06 Thread John Sayeau
> I would have expected the fixtures to have been generated when you
> generated the model.  Are you sure you put the right fields in when
> you generated the user model?


That makes sense except the user model looks correct. Unless I made a 
mistake the first time I generated the model and then fixed it and then 
forgot that I fixed it...?
I think to fix it, though, I would have regenerated the model which I 
would have thought would regenerate the fixture. I'll have to experiment 
and see...

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

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



Re: [Rails] Emacs tips

2010-12-06 Thread Rajinder Yadav
On Mon, Dec 6, 2010 at 12:44 PM, Hooptie45  wrote:
> Hey folks, I am just getting back into Emacs, coming from Textmate,
> and thought I would see if anybody has any cool tricks to share. In
> the 2 days i've been hacking around I have been aww struck many times.
> predictive-mode for one blew my mind. And rails reloaded along with
> rinari-minor-mode are very cool. Just 3 examples of cool things. Emacs
> is so powerful!! But it is almost too powerful that you can loose
> yourself in it. So rather than diving in blind, I thought I would try
> the collective mind first.
>
> I would love for this to turn into a long thread of useful pointers
> and tips that will make us all better.
>
> P.S. Please no flame wars... I know it can be a touchy subject.
> Personally, I have every editor out there; and if editor X does
> something great; then I'll do it in editor X, until I find a way to do
> it in my favorite editor. Currently, I prefer Textmate, but use emacs
> for the sheer power. Why can't anybody just combine the Textmate UI
> with the emacs back 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

Take a look at this

http://platypope.org/yada/emacs-demo/
http://platypope.org/blog/2006/9/8/i-need-a-cool-european-accent

there is a link at the bottom tells you where to find stuff, if you've
come across something cool that's not on here I'd love to know.
-- 
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread pepe
> Many will dis it but I have found Instant Rails well suited to exactly
> that (if you have to work in windows).  The latest version of Instant
> Rails is old and uses Rails 2.0 or so it can be upgraded using gems
> (look on this list for problems with that other have had) to at least
> 2.3.  I do not know the score on 3.0 as I have not gotten there yet.  IR
> integrates all of the stuff for ROR including Ruby, the db server
> (mysql) and mongrel (I think, if not you can install it using gem
> install) You can just freeze all of your gems and away you go.

I had not thought about IR but it actually would not work in this
case, I think.

To make the whole picture "even better" the client will not only use
Windows but MSSQL as well, which is how the whole mess started
actually (ODBC problems). In order to use MSSQL I have to install some
gems that need the DevKit and DevKit needs Ruby to be installed with
the Rubyinstaller (if I remember the name well). That would probably
not work (I could be wrong) with Ruby installed from IR. Also the
Rails version will probably need to be upgraded to make all our
applications "compatible".

Manually installing Ruby and Mongrel and then freezing gems into the
application might be the way to go here. I'll be trying out Marnen's
suggestions for that and I will also try to replace the ODBC
dependency with something like 'tiny_tds' and see how that works.

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



[Rails] Which RoR to run on Mac OS X for a particular RoR app.

2010-12-06 Thread Rob Th
I am extremely new to RoR, I am. I am slowly but surely learning Ruby
and the Rails concepts but the environment is confusing.

I have an application that was written for my company in RoR. It is on a
ubuntu server that is going to be shut down. I want to move the app to
my two Macs (one Leopard and one Snow Leopard). We want to keep the app
to demo a business concept but it can run locally exclusively
(localhost).  So I want to move it to my Macs from the shared Ubuntu
server. I am concerned about Rails and Ruby backwards compatibility; and
if there are any particular sand traps please let me know. Also why does
gem list --local seem to indicate the Macs have multiple versions? Is
this bad? And what should I do to insure I have compatible Mac RoRs for
running the app.

The current Ubuntu is:
gem list --local
*** LOCAL GEMS ***
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
builder (2.1.2)
capistrano (2.5.4)
curb (0.3.2)
daemons (1.0.10)
fastthread (1.0.1)
GData (0.0.4)
highline (1.5.0)
hoe (1.9.0)
hpricot (0.6.164)
mysql (2.7)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.10)
net-ssh-gateway (1.0.1)
parseexcel (0.5.2)
passenger (2.0.6)
rack (0.9.1)
rails (2.2.2)
rak (1.0)
rake (0.8.4, 0.8.3)
rcov (0.8.1.2.0)
roo (1.2.3)
rubyforge (1.0.3)
rubyzip (0.9.1)
uuidtools (1.0.7)
ruby - v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
---
The Leopard Mac:
gem list --local
*** LOCAL GEMS ***
actionmailer (2.3.8, 2.2.2, 1.3.6)
actionpack (2.3.8, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.8, 2.2.2, 1.15.6)
activeresource (2.3.8, 2.2.2)
activesupport (2.3.8, 2.2.2, 1.4.4)
acts_as_ferret (0.4.1)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.9.5, 0.3.8.4)
mongrel (1.1.4, 1.0.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rack (1.1.0)
rails (2.3.8, 2.2.2, 1.2.6)
rake (0.8.4, 0.7.3)
RedCloth (3.0.4)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.3.1)
rubynode (0.1.3)
sqlite3-ruby (1.2.1)
termios (0.9.4)
rails -v
Rails 2.3.8
ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]

---
The Snow Leopard Mac:

gem list --local
*** LOCAL GEMS ***
actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.8, 2.3.5, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
libxml-ruby (1.1.2)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
rack (1.1.0, 1.0.1)
rails (2.3.8, 2.3.5, 2.2.2, 1.2.6)
rake (0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubynode (0.1.5)
sqlite3-ruby (1.2.4)
termios (0.9.4)
xmpp4r (0.4)
rails -v
Rails 2.3.8
ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

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

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



Re: [Rails] Windows new installation - Always problems

2010-12-06 Thread Norm Scherer

pepe wrote:

I would like to know if there is a way to 'package' an application
with all the associated gems and ship it to a new server and having it
to "just work" in a Windows environment.
  
Many will dis it but I have found Instant Rails well suited to exactly 
that (if you have to work in windows).  The latest version of Instant 
Rails is old and uses Rails 2.0 or so it can be upgraded using gems 
(look on this list for problems with that other have had) to at least 
2.3.  I do not know the score on 3.0 as I have not gotten there yet.  IR 
integrates all of the stuff for ROR including Ruby, the db server 
(mysql) and mongrel (I think, if not you can install it using gem 
install) You can just freeze all of your gems and away you go.

Although I have never done it I know that Rails can be frozen into the
application. I am wondering if I can do the same thing with other
gems. I have found this (http://gemsonrails.rubyforge.org) that seems
to be what I need, although it's from 2007 and I was wondering if
anybody is using it and/or there are other or better alternatives.

Since I can't use RVM I have looked into Pik but that, I believe, will
not help me since it's a way to keep environments separate, not
'package' the application as I need it.

Also, would it be possible to include Ruby and Mongrel in the
'package'? That would be just great.

Any help would be greatly appreciated.

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



[Rails] Re: Render partial generate unwanted spaces

2010-12-06 Thread Julien
On 6 déc, 15:28, Julien  wrote:
> On 6 déc, 12:30, Colin Law  wrote:
>
>
>
>
>
>
>
>
>
> > On 6 December 2010 11:03, Julien  wrote:
>
> > > On 6 déc, 09:53, Colin Law  wrote:
> > >> On 5 December 2010 22:44, Julien  wrote:
>
> > >> > exact same poltergeist for me on rails 3.0.1 and ruby 1.9.2. It adds
> > >> > some visible space in browser but completely invisible in the
> > >> > generated HTML.
>
> > >> > it seems to be when the partial starts by a tag (like "").
> > >> > It's not a space but a linebreak. If partial starts by basic simple
> > >> > text it's fine.
> > >> > I checked my ruby source files encoding and it's plain good utf8.
>
> > >> > The generated html may look exactly the same using 'source>view' in
> > >> > both cases but i'm wondering if there might be some fancy digits
> > >> > making this linebreak.
>
> > >> If the html (and javascript and css) are the same then it must render
> > >> the same, that is all the browser has to go on.  Copy and paste the
> > >> html into a text file for each case and then do a file compare.  Also
> > >> if you want to see where the extra space is coming from use firebug in
> > >> firefox and you can see which div or whatever the space is in and how
> > >> the area is styled.
>
> > >> I note that the OP was not heard from again after he was asked to
> > >> check the generated html in this way (with the request re-inforced by
> > >> Marnen as it appeared he may not have understood that it was the html
> > >> that was to be compared).
>
> > >> Colin
>
> > > Hi ! Thanks for reply, i have news:
> > > In Firefox, the generated html seems exactly the same, but in Chrome,
> > > i can see an extra-digit.
> > > Screen:http://lh4.ggpht.com/_Hc_PJsJ5czI/TPy9KFd3RsI/AAABNIc/bApGqfK32fE...
>
> > Well I have to apologise for suggesting that if the html looked the
> > same then it would render the same.  I had not allowed for
> > non-displaying characters.  I wonder whether you are on developing on
> > windows?  I seem to remember a problem with <%-  -%> that the -
> > removed the LF but not the CR in files with CRLF line endings.
>
> > Colin
>
> Yep, Windows. When i print special chars in Komodo, i see LF ending
> each line, but no CR. I'm really not at ease with those file format
> issues, can't be really helpful on that, sorry :(

Confirmation of my second guess:

It's Komodo Editor, adding ugly stuff.
I've open and added some files in the projects using Radrails and
everything is okay.
Though i have no way to correct files corrupted by Komodo (open and
save doesn't do the trick).
Damn Komodo!!! And maybe some other text-editors generate the same
kind of horror.

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Marnen Laibow-Koser
Again: please quote when replying!

Mark Lohstroh wrote in post #966611:
> Yes, barely,

OK, then go review your basic HTML syntax.  Use of 

[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Mark Lohstroh
Yes, barely, but i thought with rails that you had to include it in the 
application.html.erb file here <%= javascript_include_tag :defaults, 
then add whatever you need here %> but i'm not sure what the syntax to 
add an additional javascript library is.

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

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Marnen Laibow-Koser
Please quote when replying.

Mark Lohstroh wrote in post #966605:
> Ok, then I'm still not sure how to add them. I included them in the
> public/javascript/ directory and i'm not sure how to tell ruby to use
> them in the application.html.erb file.

Do you know how to include references to JavaScript files in HTML in 
general?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: How to add facebook javascript sdk to rails app

2010-12-06 Thread Mark Lohstroh
Ok, then I'm still not sure how to add them. I included them in the 
public/javascript/ directory and i'm not sure how to tell ruby to use 
them in the application.html.erb file.

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

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



[Rails] Re: Re: iframe for Ruby on Rails

2010-12-06 Thread Marnen Laibow-Koser
Colin Law wrote in post #966581:
> On 6 December 2010 16:40, Marnen Laibow-Koser 
> wrote:
>>
>>> please can anybody help me.
>>
>> No, no one can help you with the meager information you provided.
>> Please be more specific.
>>
>
> I would not hold your breath awaiting enlightenment Marnen.  The OP
> never responded to repeated requests for clarification on his last
> request for help on 'calling RoR app from drupal'.

I noticed. :)  But I *do* think he should know why he hasn't got any 
help so far.  What he does with that info is up to him...

>
> Colin

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966582:
[...]
> Some clients "impose" the infrastructure and that's what we have to
> work with. I've been told "We want Oracle because we already have it
> and we don't want to have to learn to maintain MySQL/PostgreSQL/
> other". They prefer Windows for the same exact reason. Learning Linux
> is something they just don't want to do. It's unfortunate but it's
> reality.

Oh, I'm aware of that.  But that doesn't mean we have to support bizarre 
technical requirements.  I think I'd turn down a client who wanted me to 
deploy a Rails application on Windows.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Problem uploading files (possibly an OS X issue?)

2010-12-06 Thread Nicolas Aguttes
Hello,

I am implementing uploadify in my rails apps and I currently have a
similar problem as described in this old post
(http://www.ruby-forum.com/topic/156139) with the same error message.
This message occurs only when I try to upload a file when on a Mac and
the apps being deploued on my hoster environment (Apache+fastCGI).
Uploading from a windows environment works fine

Here is my configuration:
Development: Mac OS X.6, with rails 2.1.2, uploadify 2.1.4, webrick
--> everything is ok
Integration:
Mac OS X.6 on +flash 10 the client side and, rails 2.1.2+ Apache
2.2+fastCGI on the server side

I get this message only if I try to upload a file from a Mac, on a
windows platform it work ok.


Any idea on the solution?
Thanks in advance

Nicolas

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

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



[Rails] Emacs tips

2010-12-06 Thread Hooptie45
Hey folks, I am just getting back into Emacs, coming from Textmate,
and thought I would see if anybody has any cool tricks to share. In
the 2 days i've been hacking around I have been aww struck many times.
predictive-mode for one blew my mind. And rails reloaded along with
rinari-minor-mode are very cool. Just 3 examples of cool things. Emacs
is so powerful!! But it is almost too powerful that you can loose
yourself in it. So rather than diving in blind, I thought I would try
the collective mind first.

I would love for this to turn into a long thread of useful pointers
and tips that will make us all better.

P.S. Please no flame wars... I know it can be a touchy subject.
Personally, I have every editor out there; and if editor X does
something great; then I'll do it in editor X, until I find a way to do
it in my favorite editor. Currently, I prefer Textmate, but use emacs
for the sheer power. Why can't anybody just combine the Textmate UI
with the emacs back 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread Colin Law
On 6 December 2010 17:05, John Sayeau  wrote:
> Maybe Because I'm running rails 2.3.5 and the book uses something lower
> I have something different fixtures. I swapped in the ones from the
> book's source and now it works. I hope I get an explanation as to
> fixtures use as I go on in the book...thanks.
>
> This is what was in my users.yml file:
>
> # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
>
> one:
>  title: MyString
>  description: MyText
>  image_url: MyString
>
> two:
>  title: MyString
>  description: MyText
>  image_url: MyString

I would have expected the fixtures to have been generated when you
generated the model.  Are you sure you put the right fields in when
you generated the user model?  Check back in your source control
system and see when you created it.  The fixtures should match the
migration created at the same time.  If you are not using a source
control system then install git and start using it.  The few hours
learning curve (if you do not already use it) will be recovered many
times over.

Colin

>
> I looked at the source code from the book and for users.yml, it is this:
>
>
> <% SALT = "NaCl" unless defined?(SALT) %>
>
> dave:
>  name: dave
>  salt: <%= SALT %>
>  hashed_password: <%= User.encrypted_password('secret', SALT) %>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread John Sayeau
Maybe Because I'm running rails 2.3.5 and the book uses something lower 
I have something different fixtures. I swapped in the ones from the 
book's source and now it works. I hope I get an explanation as to 
fixtures use as I go on in the book...thanks.

This is what was in my users.yml file:

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

one:
  title: MyString
  description: MyText
  image_url: MyString

two:
  title: MyString
  description: MyText
  image_url: MyString

I looked at the source code from the book and for users.yml, it is this:


<% SALT = "NaCl" unless defined?(SALT) %>

dave:
  name: dave
  salt: <%= SALT %>
  hashed_password: <%= User.encrypted_password('secret', SALT) %>

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread pepe
> > I looked into JRuby some time ago. What would that buy me in
> > relationship to 'packaging' the application?
>
> Well, you could compile the whole thing as a WAR file and deploy it as a
> Java servlet.  Glassfish supposedly gets you similar benefits without
> needing to compile.
>
> I don't use JRuby for Rails, but I understand it tends to be the easiest
> way to get things working on Windows.

Thanks

> >> Better yet, don't deploy on Windows.
>
> > You couldn't resist, could you? :D
>
> No.  Why do things that are painful if a known non-painful way is
> available?

Some clients "impose" the infrastructure and that's what we have to
work with. I've been told "We want Oracle because we already have it
and we don't want to have to learn to maintain MySQL/PostgreSQL/
other". They prefer Windows for the same exact reason. Learning Linux
is something they just don't want to do. It's unfortunate but it's
reality.

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



Re: [Rails] Re: iframe for Ruby on Rails

2010-12-06 Thread Colin Law
On 6 December 2010 16:40, Marnen Laibow-Koser  wrote:
> Koteswara rao Vuyyuru wrote in post #966461:
>> Is it possible to use iframes for integrating two sites .
>>
>> I have two ruby on rails application.Then how to ingrate these two
>> application .
>
> Don't be an ingrate.  That just gets people upset. :)
>
> As for how to *integrate* the two applications, that depends on the
> functionality you want to provide.
>
>> please can anybody help me.
>
> No, no one can help you with the meager information you provided.
> Please be more specific.
>

I would not hold your breath awaiting enlightenment Marnen.  The OP
never responded to repeated requests for clarification on his last
request for help on 'calling RoR app from drupal'.

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread John Sayeau
Colin Law wrote in post #966572:

>
> If the error occurs before it actually starts running the tests and
> happens whatever test you are running it may be an issue with loading
> the fixtures into the test database.  Have you got fixtures for the
> users table (probably test/fixtures/users.yml)?  Have you got
> image_url specified in the fixture but not in the database?
>
> Once you have worked through the tutorial then I would advise
> forgetting about fixtures and using Factories instead.
>
> Colin


pretty sure this is the problem. For some reason the generated users.yml 
and the generated products.yml file are the same.  Just started this 
chapter about an hour ago so I don't exactly understand what these files 
are for yet...thanks. I'll just try editing the users.yml file to get it 
to reflect the columns in the table.

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966573:
[...]
>> Mongrel is a gem, but it's got compiled bits IIRC.
>
> Yes, I know it's a gem. I'm guessing I'm wrong but I thought it would
> be easier/best if I have it installed "in the open" and use Windows
> services if I am running more than one application on the same server.
> Can I start a Windows service if I have Mongrel frozen under the
> application?

I have no idea.  I don't use Windows.

>
>> Investigate JRuby and Glassfish.
>
> I looked into JRuby some time ago. What would that buy me in
> relationship to 'packaging' the application?

Well, you could compile the whole thing as a WAR file and deploy it as a 
Java servlet.  Glassfish supposedly gets you similar benefits without 
needing to compile.

I don't use JRuby for Rails, but I understand it tends to be the easiest 
way to get things working on Windows.

>
>> Better yet, don't deploy on Windows.
>
> You couldn't resist, could you? :D

No.  Why do things that are painful if a known non-painful way is 
available?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread Marnen Laibow-Koser
Colin Law wrote in post #966572:
[...]
> Once you have worked through the tutorial then I would advise
> forgetting about fixtures and using Factories instead.

Amen to that.  Fixtures are evil, so much so that I no longer believe 
that *any* test environment using fixtures can be considered a proper 
testing environment.

>
> Colin

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread pepe
> Rails doesn't ever "just work" on Windows, does it?

:)

> > Although I have never done it I know that Rails can be frozen into the
> > application. I am wondering if I can do the same thing with other
> > gems. I have found this (http://gemsonrails.rubyforge.org) that seems
> > to be what I need, although it's from 2007 and I was wondering if
> > anybody is using it and/or there are other or better alternatives.
>
> Rails 2: rake gems:unpack
> Rails 3: Bundler (which you can also install for use with Rails 2 if you
> like)

Will look into that. Thanks.

> Mongrel is a gem, but it's got compiled bits IIRC.

Yes, I know it's a gem. I'm guessing I'm wrong but I thought it would
be easier/best if I have it installed "in the open" and use Windows
services if I am running more than one application on the same server.
Can I start a Windows service if I have Mongrel frozen under the
application?

> Investigate JRuby and Glassfish.

I looked into JRuby some time ago. What would that buy me in
relationship to 'packaging' the application?

> Better yet, don't deploy on Windows.

You couldn't resist, could you? :D

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



[Rails] Re: iframe for Ruby on Rails

2010-12-06 Thread Marnen Laibow-Koser
Koteswara rao Vuyyuru wrote in post #966461:
> Is it possible to use iframes for integrating two sites .
>
> I have two ruby on rails application.Then how to ingrate these two
> application .

Don't be an ingrate.  That just gets people upset. :)

As for how to *integrate* the two applications, that depends on the 
functionality you want to provide.

> please can anybody help me.

No, no one can help you with the meager information you provided. 
Please be more specific.

>
> Thanks @ Regards
> V.Koteswara Rao.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



Re: [Rails] testing chapter: agile web dev withrails

2010-12-06 Thread Colin Law
On 6 December 2010 16:11, John Sayeau  wrote:
> I am working my way through Agile web development with rails and I'm in
> the testing chapter.
> when I run the following test(or any other test)
> I'm new and not sure where to start looking.
>
> require 'test_helper'
>
> class ProductTest < ActiveSupport::TestCase
>  # Replace this with your real tests.
>  test "the truth" do
>    assert true
>  end
> end
>
>  I always get
>
> ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has
> no column named image_url: INSERT INTO "users" ("created_at",
> "image_url", "title", "updated_at", "id", "description") VALUES
> ('2010-12-06 16:04:02', 'MyString', 'MyString', '2010-12-06 16:04:02',
> 298486374, 'MyText')

If the error occurs before it actually starts running the tests and
happens whatever test you are running it may be an issue with loading
the fixtures into the test database.  Have you got fixtures for the
users table (probably test/fixtures/users.yml)?  Have you got
image_url specified in the fixture but not in the database?

Once you have worked through the tutorial then I would advise
forgetting about fixtures and using Factories instead.

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



[Rails] How to use a partial in multipart/alternative emails (HTML and plain text)

2010-12-06 Thread Tom Ha
Hi there,

I use a partial in various multipart emails (HTML and plain text) in
Rails and have the following problem with it:

- All email "views" exist normally: both in .text.plain.erb and
.text.html.erb versions

- The partial (which is located in the "shared" views folder), also
exists in both versions using the required endings (as mentioned above).

The problem: In the "plain text" version of the received emails, it is
the HTML partial that is rendered, not the "plain text" one. (Everything
else is rendered correctly in both versions.)

What am I probably doing wrong?

Thanks a bunch for any help with this!
Tom

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

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



Re: [Rails] testing chapter: agile web dev withrails

2010-12-06 Thread Hassan Schroeder
On Mon, Dec 6, 2010 at 8:11 AM, John Sayeau  wrote:
> I am working my way through Agile web development with rails and I'm in
> the testing chapter.
> when I run the following test(or any other test)

> ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has
> no column named image_url:

So *does* your test database have such a column? Have you maybe
created a migration previously to add it, but not run migrations on your
test db?

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread Marnen Laibow-Koser
Please quote when replying.

John Sayeau wrote in post #966562:
> I get that the error says that it's trying to insert inappropriate data
> into the users table. It looks like I just need to find out why it's
> picking the users table instead of the products table. I don't know
> where the insert is coming from.

Rails always gives a line number as part of its stack trace when errors 
are generated.  If looking there is not sufficient, then perhaps you 
should use the debugger to step through your code and find out.  Or 
write more tests to figure out where the failure is.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread John Sayeau
I get that the error says that it's trying to insert inappropriate data 
into the users table. It looks like I just need to find out why it's 
picking the users table instead of the products table. I don't know 
where the insert is coming from.

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

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



Re: [Rails] Re: production.log is always empty

2010-12-06 Thread Hassan Schroeder
On Mon, Dec 6, 2010 at 7:43 AM, John Merlino  wrote:
> Actually after deleting it, it is recreated with this:
>
> # Logfile created on Mon Dec 06 10:19:07 -0500 2010
>
> But nothing else.

OK, instead of my original suggestion using logger:

Open a console in production mode and
>> RAILS_DEFAULT_LOGGER.info("what the hey")

instead try a simple `puts "-- hey, I'm talking to you"` and see if that
shows up (again, anywhere, not just in the production log).

Also, what's the console output of

RAILS_DEFAULT_LOGGER

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



[Rails] Re: Strange problem with CSV and funny chars

2010-12-06 Thread Colin Law
On 6 December 2010 09:30, Colin Law  wrote:
> On 5 December 2010 21:02, Colin Law  wrote:
>> [...]
>> So it appears that "\xA3" and row['price'][0] are both strings of
>> length 1 and both contain the byte value 163 yet "\xA3" is definitely
>> greater than row['price'][0]
>> If I do c1 = row['price'][0] and c2 = "\xA3" I still get the same
>> effect.  The variables c1 and c2 contain the same data but are
>> different when compared.
>
> I woke up in the middle of the night and realised that this must be an
> encoding issue.
>
> If I check the encoding of the two strings then I see that '\xa3' is
> utf-8 but the data read by csv is ascii-8bit.
>
> (rdb:1) '\xa3'.encoding.name
> "UTF-8"
> (rdb:1) row['price'].encoding.name
> "ASCII-8BIT"
>
> This makes sense as CSV is reading an ascii text file.  So it appears
> that in ruby 1.9.2 two strings that have the same contents and display
> the same, but are of different encodings, do not compare equal.
> Whether they should compare or not I do not know.

Just in case anybody has a similar problem and finds this in the
future here is what I had to do sort out the issue.  I needed to
convert \xA3 chars in the ascii data read by CSV into UK Pound signs.
I had the same encoding issues with the regular expression and this is
what I had to do to achieve the desired effect

At the top of the file (seeds.rb)
#encoding: utf-8
...
regex = Regexp.new( "\xA3".force_encoding('ASCII-8BIT') )
Then to do the sub
row['price'] = row['price'].gsub( regex, '£'.force_encoding('ASCII-8BIT') )

Then when it came to updating the ActiveRecord object with the data
read by CSV I had to force it to utf-8
model.price = row['price'].force_encoding('UTF-8')

This all works but I have to say that I am not sure that I fully
understand all the encoding issues, so there may well be better ways.

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



[Rails] Re: testing chapter: agile web dev withrails

2010-12-06 Thread Marnen Laibow-Koser
John Sayeau wrote in post #966558:
> I am working my way through Agile web development with rails and I'm in
> the testing chapter.
> when I run the following test(or any other test)
> I'm new and not sure where to start looking.

Read the error message!  It tells you what you need to know.

Bonus tip: once you finish the testing tutorial, check out RSpec as a 
replacement for Test::Unit and factories (Machinist or FactoryGirl) as a 
replacement for fixtures.  They're much nicer tools than the ones 
provided by the core team.

>
> require 'test_helper'
>
> class ProductTest < ActiveSupport::TestCase
>   # Replace this with your real tests.
>   test "the truth" do
> assert true
>   end
> end
>
>  I always get
>
> ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has
> no column named image_url: INSERT INTO "users" ("created_at",
> "image_url", "title", "updated_at", "id", "description") VALUES
> ('2010-12-06 16:04:02', 'MyString', 'MyString', '2010-12-06 16:04:02',
> 298486374, 'MyText')

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] testing chapter: agile web dev withrails

2010-12-06 Thread John Sayeau
I am working my way through Agile web development with rails and I'm in
the testing chapter.
when I run the following test(or any other test)
I'm new and not sure where to start looking.

require 'test_helper'

class ProductTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  test "the truth" do
assert true
  end
end

 I always get

ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has
no column named image_url: INSERT INTO "users" ("created_at",
"image_url", "title", "updated_at", "id", "description") VALUES
('2010-12-06 16:04:02', 'MyString', 'MyString', '2010-12-06 16:04:02',
298486374, 'MyText')

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

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



[Rails] Re: Overriding or aliasing name of column in legacy database using Rails/ActiveRecord

2010-12-06 Thread Marnen Laibow-Koser
Mike B wrote in post #966542:
> Thanks for the suggestion.

Please quote when replying -- I have no idea whom you're thanking for 
what suggestion.

> Gave it a try but it appears that support
> for aliased columns does not run very deep in ActiveRecord.
>
> For example, if you alias obj_id to object_id and then try to do:
> Object.find_by_obj_id(3) it complains that the method is unknown.

But find_by_object_id should work.

>
> I did a bit of digging on sqlite3 updateable views and it appears that
> this can be accomplished by writing some triggers. Same applies for
> postgres and others as well.
>
> Barring an absolutely brilliant suggestion I'm going to pursue this
> solution.

Please don't do that yet.  Spend some more time with aliased attributes 
-- you shouldn't need to write a view for something this simple.  If it 
were my DB, I'd either use alias_attribute or something like Philip's 
solution.  There should be no need for views here.

Actually, I'd probably change the name of the field.  The legacy 
application shouldn't be a concern: no two applications should directly 
touch the same DB anyway IMHO.  Another good idea might be to have the 
legacy application expose a REST service (with any field names you 
like!) that the Rails application can interact with by using 
ActiveResource (this is sort of what we've done here at my job).

If you *do* need DB views, try the rails_sql_views plugin.

>
> Thanks to all,
> Mike

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

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

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



[Rails] Re: Re: Re: Re: Re: Remove bundler

2010-12-06 Thread Paul Bergstrom
David Kahn wrote in post #966552:

> If you add a gem and are using a gemset it will go in your gemset
> makes
> it pretty easy to swallow experimentation as you can just delete your
> gemset
> and start over if you really want.

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



Re: [Rails] Re: Re: Re: Re: Remove bundler

2010-12-06 Thread David Kahn
On Mon, Dec 6, 2010 at 4:21 AM, Colin Law  wrote:

> On 6 December 2010 10:12, Paul Bergstrom  wrote:
> > Colin Law wrote in post #966453:
> >
> >> If you do actually need it then just add the gem to Gemfile (in the
> >> root of your app) and run
> >> bundle install
> >> If the problem is that rails thinks you need it but you do not then
> >> maybe it is already in Gemfile but should not be.  In that case remove
> >> it from Gemfile and run bundle install.
> >>
> >> Colin
> >
> > Can I ignore the Gemfile.lock?
>
> You should include it in your source control system (along with
> Gemfile).  Bundler uses to keep track of what it has done I think.
>
> >
> > Will the gem be installed in my rvm gemset? Or where does it go?
>
> Yes to the former I believe.  You can always try it and see for yourself.
>

If you add a gem and are using a gemset it will go in your gemset makes
it pretty easy to swallow experimentation as you can just delete your gemset
and start over if you really want.

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

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



[Rails] Re: production.log is always empty

2010-12-06 Thread John Merlino
Actually after deleting it, it is recreated with this:

# Logfile created on Mon Dec 06 10:19:07 -0500 2010

But nothing else.

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

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



[Rails] Re: Overriding or aliasing name of column in legacy database using Rails/ActiveRecord

2010-12-06 Thread Mike B
Thanks for the suggestion. Gave it a try but it appears that support
for aliased columns does not run very deep in ActiveRecord.

For example, if you alias obj_id to object_id and then try to do:
Object.find_by_obj_id(3) it complains that the method is unknown.

I did a bit of digging on sqlite3 updateable views and it appears that
this can be accomplished by writing some triggers. Same applies for
postgres and others as well.

Barring an absolutely brilliant suggestion I'm going to pursue this
solution.

Thanks to all,
Mike

On Dec 5, 6:33 pm, Marnen Laibow-Koser  wrote:
> Marnen Laibow-Koser wrote in post #966357:
>
> > Mike B wrote in post #966322:
> >> I would like to be able to support mssql, postgres, oracle, and
> >> sqlite3. My understanding is that updateable views wouldn't work for
> >> sqlite3, but I'll have to do a bit more research.
>
> > Unless I'm badly mistaken, you should just need to use alias_attribute.
> > No DB view is necessary.
>
> ...or not.  I looked at the source of alias_attribute, and I'm not sure
> if it will work. But do try it before messing with DB views.
>
>
>
> >> Thanks for your suggestion.
>
> > Best,
> > -- 
> > Marnen Laibow-Koser
> >http://www.marnen.org
> > mar...@marnen.org
>
> > Sent from my iPhone
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: SQL codes on Controller

2010-12-06 Thread Marnen Laibow-Koser
Kishoj B. wrote in post #966523:
> I use the SQL code in the controller as follow:
>
> sql = ActiveRecord::Base.connection();
> @countlikes = sql.execute("SELECT COUNT(rateint) as result FROM
> rates");
>
> But it returns the resuls as # in the view i.e.
> @countlikes =  #
>
> I wanted the integer value. I am wondering how to use sql codes in the
> controller

You don't need to.  Look up the docs for ActiveRecord::Calculations.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

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

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



[Rails] Re: Re: production.log is always empty

2010-12-06 Thread John Merlino
> Did you delete the production.log? Did it get recreated when you
> started the application?

I'm not sure exactly what you mean, but this is what I tried. In 
textmate:

• I deleted production.log
• Then restarted server locally

No file was recreated.

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

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



[Rails] Re: Re: production.log is always empty

2010-12-06 Thread John Merlino
> Inserting your reply inline also makes it more likely that all issues
> in previous post will be addressed.  You have said that the production
> log is not written to but you have not answered my previous question:
> When you believe that you are running in production mode is
> development.log still getting written to?
> Or any other log for that matter.
>
> Colin

No other log is getting written to. The only time a log is written to is 
the development log when I am running the app locally:

Processing DashboardsController#index (for 127.0.0.1 at 2010-12-06 
09:30:04) [GET]
  [4;36;1mDashboard Load (87.7ms)[0m   [0;1mSELECT * FROM `dashboards` 
[0m
Rendering template within layouts/application
Rendering dashboards/index
  [4;35;1mDashboard Columns (28.2ms)[0m   [0mSHOW FIELDS FROM 
`dashboards`[0m
  [4;36;1mUser Columns (3.9ms)[0m   [0;1mSHOW FIELDS FROM `users`[0m
Completed in 781ms (View: 631, DB: 121) | 200 OK [http://localhost/]

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

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



[Rails] Re: Windows new installation - Always problems

2010-12-06 Thread Marnen Laibow-Koser
pepe wrote in post #966524:
> I would like to know if there is a way to 'package' an application
> with all the associated gems and ship it to a new server and having it
> to "just work" in a Windows environment.

Rails doesn't ever "just work" on Windows, does it?

>
> Although I have never done it I know that Rails can be frozen into the
> application. I am wondering if I can do the same thing with other
> gems. I have found this (http://gemsonrails.rubyforge.org) that seems
> to be what I need, although it's from 2007 and I was wondering if
> anybody is using it and/or there are other or better alternatives.

Rails 2: rake gems:unpack
Rails 3: Bundler (which you can also install for use with Rails 2 if you 
like)

>
> Since I can't use RVM I have looked into Pik but that, I believe, will
> not help me since it's a way to keep environments separate, not
> 'package' the application as I need it.

It might still help you.

>
> Also, would it be possible to include Ruby and Mongrel in the
> 'package'? That would be just great.

Mongrel is a gem, but it's got compiled bits IIRC.

>
> Any help would be greatly appreciated.

Investigate JRuby and Glassfish.  Better yet, don't deploy on Windows.

>
> Thank you.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

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

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



[Rails] Re: Render partial generate unwanted spaces

2010-12-06 Thread Julien
On 6 déc, 12:30, Colin Law  wrote:
> On 6 December 2010 11:03, Julien  wrote:
>
>
>
>
>
>
>
>
>
> > On 6 déc, 09:53, Colin Law  wrote:
> >> On 5 December 2010 22:44, Julien  wrote:
>
> >> > exact same poltergeist for me on rails 3.0.1 and ruby 1.9.2. It adds
> >> > some visible space in browser but completely invisible in the
> >> > generated HTML.
>
> >> > it seems to be when the partial starts by a tag (like "").
> >> > It's not a space but a linebreak. If partial starts by basic simple
> >> > text it's fine.
> >> > I checked my ruby source files encoding and it's plain good utf8.
>
> >> > The generated html may look exactly the same using 'source>view' in
> >> > both cases but i'm wondering if there might be some fancy digits
> >> > making this linebreak.
>
> >> If the html (and javascript and css) are the same then it must render
> >> the same, that is all the browser has to go on.  Copy and paste the
> >> html into a text file for each case and then do a file compare.  Also
> >> if you want to see where the extra space is coming from use firebug in
> >> firefox and you can see which div or whatever the space is in and how
> >> the area is styled.
>
> >> I note that the OP was not heard from again after he was asked to
> >> check the generated html in this way (with the request re-inforced by
> >> Marnen as it appeared he may not have understood that it was the html
> >> that was to be compared).
>
> >> Colin
>
> > Hi ! Thanks for reply, i have news:
> > In Firefox, the generated html seems exactly the same, but in Chrome,
> > i can see an extra-digit.
> > Screen:http://lh4.ggpht.com/_Hc_PJsJ5czI/TPy9KFd3RsI/AAABNIc/bApGqfK32fE...
>
> Well I have to apologise for suggesting that if the html looked the
> same then it would render the same.  I had not allowed for
> non-displaying characters.  I wonder whether you are on developing on
> windows?  I seem to remember a problem with <%-  -%> that the -
> removed the LF but not the CR in files with CRLF line endings.
>
> Colin

Yep, Windows. When i print special chars in Komodo, i see LF ending
each line, but no CR. I'm really not at ease with those file format
issues, can't be really helpful on that, sorry :(

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



[Rails] Windows new installation - Always problems

2010-12-06 Thread pepe
I would like to know if there is a way to 'package' an application
with all the associated gems and ship it to a new server and having it
to "just work" in a Windows environment.

Although I have never done it I know that Rails can be frozen into the
application. I am wondering if I can do the same thing with other
gems. I have found this (http://gemsonrails.rubyforge.org) that seems
to be what I need, although it's from 2007 and I was wondering if
anybody is using it and/or there are other or better alternatives.

Since I can't use RVM I have looked into Pik but that, I believe, will
not help me since it's a way to keep environments separate, not
'package' the application as I need it.

Also, would it be possible to include Ruby and Mongrel in the
'package'? That would be just great.

Any help would be greatly appreciated.

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



[Rails] SQL codes on Controller

2010-12-06 Thread kishoj
I use the SQL code in the controller as follow:

sql = ActiveRecord::Base.connection();
@countlikes = sql.execute("SELECT COUNT(rateint) as result FROM
rates");

But it returns the resuls as # in the view i.e.
@countlikes =  #

I wanted the integer value. I am wondering how to use sql codes in the
controller

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



Re: [Rails] Re: Again on facebook

2010-12-06 Thread rajeevsharma86
Thanks buddy

On Mon, Dec 6, 2010 at 7:20 PM, Ar Chron  wrote:

> If YOU don't know how you want to use the data in your application, then
> why are you asking here???   Why are you even worried about it?
>
> If getting Rails/Ruby to hook up to facebook was just a technical
> exercise to learn an interface, then be done with 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Thanks:
Rajeev sharma
+919013155133

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



  1   2   >