Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
If you want to do revisions on existing tables (adding columns, changing
data types, etc.) you can use migrations for that as well.  Experiment on
the command line with patterns like:

rails g migration add_columns_to_addresses column_1:string column_2:integer
...
rails g migration remove_columns_from_addresses column_1:string
column_2:integer ...

The generator will try to figure out what you're attempting to do if you
give it some basic instructions and if what you want to do isn't too
complicated.

On Fri, Jul 29, 2011 at 8:35 AM, Rick & Nellie Flower wrote:

> Thanks for the reply Chris..
>
> I'll switch away from Camelcase.. I use that at work all day long (C++) so
> I'm used to looking at
> it.
>
> I initially used the generator but when revising tables it didn't want to
> run anymore complaining
> some of the files were already there -- which is why I resorted to
> hand-edits.  I'll do some more
> reading on what you suggested.. Thx!
>
> -- Rick
>
> On Jul 28, 2011, at 11:22 PM, Chris Kottom wrote:
>
> Are you not using generators for the initial creation of your model and
> migration source files?  I'm asking because I think I can count on one hand
> the number of times I've ever written out a create_table function myself.
>  Your inputs from the command line should do all this for you along with
> some of the work of setting up your model associations (e.g. the belongs_to
> call in your Address class definition) and save you some effort.  If you're
> using the generators properly, you may never have to touch the migration
> files for simpler applications.
>
> rails g scaffold user acctLocked:boolean familyId:integer
> isProfileSetup:boolean ...
> rails g model address user:references address:string city:string ...
>
>
> For more info:
> http://guides.rubyonrails.org/getting_started.html
> http://guides.rubyonrails.org/command_line.html#rails-generate
>
> One other small thing: you're writing your variable names using camel case
> (lowerCaseWithCapitalsIndicatingWordBoundaries) whereas the more widely
> recognized Ruby convention is to use all_lower_case_with_underscores.  I
> left your variable names as-is in the sample code above, but if it's code
> that anyone else will ever see or work on, you might consider changing it.
>
> On Fri, Jul 29, 2011 at 4:43 AM, Rick & Nellie Flower 
> wrote:
>
>> Ok.. Still working on this stuff.. I've got the t.reference in the
>> migration for the address class and moved the belongs_to and has_one in the
>> model classes as indicated (I didn't notice that!).
>>
>> I noticed in the association-basics that I should be putting a
>> create_table function (if that's what
>> it's called) in the CreateUsers class for Migrations but I'm concerned
>> about doing that since I'll be using the address class on more than just the
>> 'users' class -- does it really belong there or ??
>> Perhaps I'm overthinking this.. ??
>>
>> Below are the two class definitions for both the model & migration :
>>
>> class Address < ActiveRecord::Base
>>  belongs_to :user
>>  belongs_to :organization
>>  belongs_to :supplier
>> end
>>
>> class CreateAddresses < ActiveRecord::Migration
>>
>>  def self.up
>>create_table :addresses do |t|
>>  t.string :address
>>  t.string :city
>>  t.string :state
>>  t.string :zip
>>  t.string :email
>>  t.string :phone
>>   t.references : users
>>
>>  t.timestamps
>>end
>>  end
>>
>>  def self.down
>>drop_table :addresses
>>  end
>> end
>>
>> =
>> class User < ActiveRecord::Base
>>  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
>>
>>  has_one :name
>>  has_one :address
>>  has_one :organization
>>
>> end
>>
>> class CreateUsers < ActiveRecord::Migration
>>
>>  def self.up
>>create_table :users do |t|
>>   t.boolean  :acctLocked
>>  t.integer  :familyId
>>   t.boolean  :isProfileSetup
>>  t.datetime :lastLogin
>>  t.string   :password
>>  t.string   :securityQ
>>  t.string   :securityA
>>  t.string   :username
>>   t.enum :accountType
>>
>>  t.timestamps
>>end
>>
>>create_table :a
>>   end
>>
>>  def self.down
>>drop_table :users
>>  end
>> end
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl

Re: [Rails] Question regarding associations..

2011-07-28 Thread Rick & Nellie Flower
Thanks for the reply Chris..

I'll switch away from Camelcase.. I use that at work all day long (C++) so I'm 
used to looking at
it.

I initially used the generator but when revising tables it didn't want to run 
anymore complaining 
some of the files were already there -- which is why I resorted to hand-edits.  
I'll do some more
reading on what you suggested.. Thx!

-- Rick

On Jul 28, 2011, at 11:22 PM, Chris Kottom wrote:

> Are you not using generators for the initial creation of your model and 
> migration source files?  I'm asking because I think I can count on one hand 
> the number of times I've ever written out a create_table function myself.  
> Your inputs from the command line should do all this for you along with some 
> of the work of setting up your model associations (e.g. the belongs_to call 
> in your Address class definition) and save you some effort.  If you're using 
> the generators properly, you may never have to touch the migration files for 
> simpler applications.
> 
> rails g scaffold user acctLocked:boolean familyId:integer 
> isProfileSetup:boolean ...
> rails g model address user:references address:string city:string ...
> 
> For more info:
> http://guides.rubyonrails.org/getting_started.html
> http://guides.rubyonrails.org/command_line.html#rails-generate
> 
> One other small thing: you're writing your variable names using camel case 
> (lowerCaseWithCapitalsIndicatingWordBoundaries) whereas the more widely 
> recognized Ruby convention is to use all_lower_case_with_underscores.  I left 
> your variable names as-is in the sample code above, but if it's code that 
> anyone else will ever see or work on, you might consider changing it.
> 
> On Fri, Jul 29, 2011 at 4:43 AM, Rick & Nellie Flower  
> wrote:
> Ok.. Still working on this stuff.. I've got the t.reference in the migration 
> for the address class and moved the belongs_to and has_one in the model 
> classes as indicated (I didn't notice that!).
> 
> I noticed in the association-basics that I should be putting a create_table 
> function (if that's what
> it's called) in the CreateUsers class for Migrations but I'm concerned about 
> doing that since I'll be using the address class on more than just the 
> 'users' class -- does it really belong there or ??
> Perhaps I'm overthinking this.. ??
> 
> Below are the two class definitions for both the model & migration :
> 
> class Address < ActiveRecord::Base
>  belongs_to :user
>  belongs_to :organization
>  belongs_to :supplier
> end
> 
> class CreateAddresses < ActiveRecord::Migration
> 
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
>  t.references : users
> 
>  t.timestamps
>end
>  end
> 
>  def self.down
>drop_table :addresses
>  end
> end
> 
> =
> class User < ActiveRecord::Base
>  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
> 
>  has_one :name
>  has_one :address
>  has_one :organization
> 
> end
> 
> class CreateUsers < ActiveRecord::Migration
> 
>  def self.up
>create_table :users do |t|
>  t.boolean  :acctLocked
>  t.integer  :familyId
>  t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
>  t.enum :accountType
> 
>  t.timestamps
>end
> 
>create_table :a
>  end
> 
>  def self.down
>drop_table :users
>  end
> end
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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



Re: [Rails] RedCloth and sanitizing input

2011-07-28 Thread Chris Kottom
I've used this before and found it to be flexible enough.  It includes a
number of out-of-box configurations to enable removal of all or just some
tags or allows you to create your own.

https://github.com/rgrove/sanitize/

On Thu, Jul 28, 2011 at 11:52 PM, Jan Marquardt  wrote:

> Hi mates,
>
> I've hit a problem and hope for some advices.
>
> I am developing a blog for my family and I want to provide the opportuniy
> that everyone may format his blog posts. After some research I found
> RedCloth. It seems that it does exactly what I want, but for output i need
> to use the raw helper.
>
> <%= raw RedCloth.new(post.content) %>
>
> But this also allows them to use HTML in their posts. What is the best
> practice to prevent the usage of HTML and sanitize the content in this case?
> Is there any plugin for achiving this?
>
> I'd be thankful for any help.
>
> Kind regards,
>
> Jan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to 
> rubyonrails-talk@googlegroups.**com
> .
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@**googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/**
> group/rubyonrails-talk?hl=en
> .
>
>

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



Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
Are you not using generators for the initial creation of your model and
migration source files?  I'm asking because I think I can count on one hand
the number of times I've ever written out a create_table function myself.
 Your inputs from the command line should do all this for you along with
some of the work of setting up your model associations (e.g. the belongs_to
call in your Address class definition) and save you some effort.  If you're
using the generators properly, you may never have to touch the migration
files for simpler applications.

rails g scaffold user acctLocked:boolean familyId:integer
isProfileSetup:boolean ...
rails g model address user:references address:string city:string ...


For more info:
http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/command_line.html#rails-generate

One other small thing: you're writing your variable names using camel case
(lowerCaseWithCapitalsIndicatingWordBoundaries) whereas the more widely
recognized Ruby convention is to use all_lower_case_with_underscores.  I
left your variable names as-is in the sample code above, but if it's code
that anyone else will ever see or work on, you might consider changing it.

On Fri, Jul 29, 2011 at 4:43 AM, Rick & Nellie Flower wrote:

> Ok.. Still working on this stuff.. I've got the t.reference in the
> migration for the address class and moved the belongs_to and has_one in the
> model classes as indicated (I didn't notice that!).
>
> I noticed in the association-basics that I should be putting a create_table
> function (if that's what
> it's called) in the CreateUsers class for Migrations but I'm concerned
> about doing that since I'll be using the address class on more than just the
> 'users' class -- does it really belong there or ??
> Perhaps I'm overthinking this.. ??
>
> Below are the two class definitions for both the model & migration :
>
> class Address < ActiveRecord::Base
>  belongs_to :user
>  belongs_to :organization
>  belongs_to :supplier
> end
>
> class CreateAddresses < ActiveRecord::Migration
>
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
>   t.references : users
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :addresses
>  end
> end
>
> =
> class User < ActiveRecord::Base
>  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
>
>  has_one :name
>  has_one :address
>  has_one :organization
>
> end
>
> class CreateUsers < ActiveRecord::Migration
>
>  def self.up
>create_table :users do |t|
>   t.boolean  :acctLocked
>  t.integer  :familyId
>   t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
>   t.enum :accountType
>
>  t.timestamps
>end
>
>create_table :a
>   end
>
>  def self.down
>drop_table :users
>  end
> end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: ActionMailer 2.0.2 NameError

2011-07-28 Thread Manimaran Malaichamy
Thanks for the info.. after i paste the code outside of the block, it 
worked for me.

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

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



Re: [Rails] Help with heroku and amazon s3 and paperclip

2011-07-28 Thread Conrad Taylor
Sent from my iPhone

On Jul 28, 2011, at 6:52 PM, Rodrigo Ruiz  wrote:

> Well, as the subject, I want to use those 3. Problem is I don't want to use 
> amazon s3 in development, I want to use it only on heroku.
> 
> How do I do that?
> 
> Thank you,
> Rodrigo
> 

If you're in development now, then just use what you need by setting up Herku.
Heroku has some really good docs on getting up and running.  Thus, I would 
recommend starting there.

Good luck,

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

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



[Rails] Re: Can you suggest a fixtures replacement for a MongoDB-based Rails 3.1 project?

2011-07-28 Thread dbkbali
I am using Mongoid and factory girl works fine. Havent used mongomapper, but 
Mongoid seems to provide the flexibility of using active record type 
relationships, with ongoing active support and upgrades to the orm.

Regards

David Krett

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



Re: [Rails] Question regarding associations..

2011-07-28 Thread Rick & Nellie Flower
Ok.. Still working on this stuff.. I've got the t.reference in the migration 
for the address class and moved the belongs_to and has_one in the model classes 
as indicated (I didn't notice that!).

I noticed in the association-basics that I should be putting a create_table 
function (if that's what
it's called) in the CreateUsers class for Migrations but I'm concerned about 
doing that since I'll be using the address class on more than just the 'users' 
class -- does it really belong there or ??  
Perhaps I'm overthinking this.. ??

Below are the two class definitions for both the model & migration :

class Address < ActiveRecord::Base
  belongs_to :user
  belongs_to :organization
  belongs_to :supplier
end

class CreateAddresses < ActiveRecord::Migration
  
  def self.up
create_table :addresses do |t|
  t.string :address
  t.string :city
  t.string :state
  t.string :zip
  t.string :email
  t.string :phone
  t.references : users

  t.timestamps
end
  end

  def self.down
drop_table :addresses
  end
end

=
class User < ActiveRecord::Base
  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
  
  has_one :name
  has_one :address
  has_one :organization
  
end

class CreateUsers < ActiveRecord::Migration
  
  def self.up
create_table :users do |t|
  t.boolean  :acctLocked
  t.integer  :familyId
  t.boolean  :isProfileSetup
  t.datetime :lastLogin
  t.string   :password
  t.string   :securityQ
  t.string   :securityA
  t.string   :username
  t.enum :accountType

  t.timestamps
end

create_table :a
  end

  def self.down
drop_table :users
  end
end

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



[Rails] Help with heroku and amazon s3 and paperclip

2011-07-28 Thread Rodrigo Ruiz
Well, as the subject, I want to use those 3. Problem is I don't want to use
amazon s3 in development, I want to use it only on heroku.

How do I do that?

Thank you,
Rodrigo

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



[Rails] Re: Printing nested data to screen

2011-07-28 Thread Andrew Skegg
Barney  writes:

> 
> And a relevant section of index.html.erb is:
>  <%= @people.each do |person| %>
>   
> ...
> <%= person.zip_code %>
> <%= person.skill_set %>
> <%= WHAT GOES HERE TO BE ABLE TO PRINT THE "position" FIELD OF
> THE employee_infos TABLE? WHAT CHANGES SHOULD BE MADE TO THE ABOVE?

If I am reading this right:

<%= person.employee_info.position %>

Note: this will trigger a database query to match the record in employee_info 
with the person's ID.  Your @employee_infos variable is not being touched.  
You really want eager load:

@people = Person.all.include(:employee_info)


> 
>  A second point was made about not having SQL statements in the
> controller (which I have done) so what is the alternative?  What pages
> can I go to to see some examples of the right way?

The seminal blog post was this http://weblog.jamisbuck.org/2006/10/18/skinny-
controller-fat-model 

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



[Rails] Re: Passing blocks through render('partialname')

2011-07-28 Thread Andrew Skegg
Brent  writes:

> 
> How can I capture the block that I pass through a partial. I want to
> be able to do something like:
> 
> <%= render 'shared/partialname' do %>
>   Misc code / text
> <% end %>
> 
> Then I want to display that block at a specific place in that partial.
> I could do this if I created a method. But I want to know how it works
> with partials.
> 


Placing <%= yield %> in your partial will determine where blocks are rendered:

#app/views/shared/partialname.html.erb
This is a partial heading
<%= yield %>

Should result in:

This is a partial heading
Misc code / text

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



Re: [Rails] Re: Nature of Return Values from Search

2011-07-28 Thread Hassan Schroeder
On Thu, Jul 28, 2011 at 3:59 PM, Barney  wrote:

> How else would I check that hash?

Besides the previously mentioned debugger, you can add logging
statements to your code to provide more information.

>     But, could you tell me what form (type, value) is the return from
> that empty text box?

It's the web -- all request parameters are strings; if no value was set
in the client then it's an empty string.

But based on the code above --
--
   @skill_search2 = String.new # blech - extraneous
   @skill_search2=:skill2.to_s   # ditto, also meaningless :-)

   if @skill_search2.empty?
--
what you want is just

   if params['skill2'].empty?

 HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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



Re: [Rails] Re: Nature of Return Values from Search

2011-07-28 Thread Eric Björkvall
Hej Barney

The debugger call will stop the execution and drop you into the debugger - it's 
not from within your text editor - it's in the
terminal window where you run your app

Start your app with 

rails server --debugger 

or (if your running rails < 3.0 )

script/server --debugger


Cheers,
Eric

On 29 jul 2011, at 00.59, Barney wrote:

> Hi Eric,
> I'm using Scite and there doesn't seem to be a debugger in it.
> How else would I check that hash?
> But, could you tell me what form (type, value) is the return from
> that empty text box?
> Thanks,
>  Barney
> 
> 
> On Jul 28, 4:59 pm, Eric Björkvall  wrote:
>> Hej
>> 
>> You probably  should check the params hash in the controller:
>> 
>> @skill_search1 = params[:skill1] etc..
>> 
>> Also use a debugger call in the search method to see the
>> parameters that are passed
>> 
>> def search
>>  debugger
>>  .
>>  .
>> end
>> 
>> Cheers,
>> Eric
>> 
>> On 28 jul 2011, at 22.03, Barney wrote:
>> 
>>> Hello,
>>> I'm trying the search method used in the Guides:
>>> http://guides.rubyonrails.org/form_helpers.html
>>> and I don't know what is coming back to the controller when a text box
>>> is empty.  When each of the 2 text boxes (described below) have a
>>> value then the search works.  However, if the second box is empty then
>>> nothing is returned, even though there is data to match the first box.
>>> The boxes are formed in the search.html.erb as:
>> 
>>> <%= form_tag({controller => "people", :action => "search"}, :method =>
>>> "get" ) do %>
>>>  <%= label_tag(:skill1, "Search Skills for:") %>
>>>  <%= text_field_tag(:skill1) %>
>>>  <%= text_field_tag(:skill2) %>
>>>  <%= submit_tag("Search") %>
>>> <% end %>
>> 
>>> And are read in the controller by:
>> 
>>> def search
>>>@people = Person.all
>>>@skill_search1 = String.new
>>>@skill_search1=:skill1.to_s
>>>@skill_search2 = String.new
>>>@skill_search2=:skill2.to_s
>> 
>>>if @skill_search2.empty?
>>>  @found_people = Person.where("skill_set LIKE ?",
>>> params[@skill_search1])
>>>else
>>>  @found_people = Person.where("skill_set LIKE ? and skill_set
>>> LIKE ?", params[@skill_search1],params[@skill_search2])
>>>end
>>>  end
>> 
>>> I have also tried: if @skill_search2  == NUL, ==  " ",== nil,
>>> =='' and ="" under the theory that if you type in everything then
>>> something might work (hey, it's worked in the past!).
>> 
>>> Looking at the output in the command window that is used for the
>>> "rails server" call to WEBRick it seems that the second conditional
>>> option is always called and the statement ends in "and skill_set LIKE
>>> ''"   (that is 2 apostrophes before the final quote and, while it's a
>>> little hard to judge, I don't think there is a space between the
>>> apostrophes).
>>> So the question is: what is being returned by the blank text box
>>> and how should it be checked?
>>> Thanks,
>>>Barney
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> rubyonrails-talk+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/rubyonrails-talk?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Nature of Return Values from Search

2011-07-28 Thread Barney
Hi Eric,
 I'm using Scite and there doesn't seem to be a debugger in it.
How else would I check that hash?
 But, could you tell me what form (type, value) is the return from
that empty text box?
 Thanks,
  Barney


On Jul 28, 4:59 pm, Eric Björkvall  wrote:
> Hej
>
> You probably  should check the params hash in the controller:
>
> @skill_search1 = params[:skill1] etc..
>
> Also use a debugger call in the search method to see the
> parameters that are passed
>
> def search
>  debugger
>  .
>  .
> end
>
> Cheers,
> Eric
>
> On 28 jul 2011, at 22.03, Barney wrote:
>
> > Hello,
> >     I'm trying the search method used in the Guides:
> >http://guides.rubyonrails.org/form_helpers.html
> > and I don't know what is coming back to the controller when a text box
> > is empty.  When each of the 2 text boxes (described below) have a
> > value then the search works.  However, if the second box is empty then
> > nothing is returned, even though there is data to match the first box.
> >     The boxes are formed in the search.html.erb as:
>
> > <%= form_tag({controller => "people", :action => "search"}, :method =>
> > "get" ) do %>
> >  <%= label_tag(:skill1, "Search Skills for:") %>
> >  <%= text_field_tag(:skill1) %>
> >  <%= text_field_tag(:skill2) %>
> >  <%= submit_tag("Search") %>
> > <% end %>
>
> > And are read in the controller by:
>
> > def search
> >    @people = Person.all
> >    @skill_search1 = String.new
> >    @skill_search1=:skill1.to_s
> >    @skill_search2 = String.new
> >    @skill_search2=:skill2.to_s
>
> >    if @skill_search2.empty?
> >      @found_people = Person.where("skill_set LIKE ?",
> > params[@skill_search1])
> >    else
> >      @found_people = Person.where("skill_set LIKE ? and skill_set
> > LIKE ?", params[@skill_search1],params[@skill_search2])
> >    end
> >  end
>
> >     I have also tried: if @skill_search2  == NUL, ==  " ",== nil,
> > =='' and ="" under the theory that if you type in everything then
> > something might work (hey, it's worked in the past!).
>
> >     Looking at the output in the command window that is used for the
> > "rails server" call to WEBRick it seems that the second conditional
> > option is always called and the statement ends in "and skill_set LIKE
> > ''"   (that is 2 apostrophes before the final quote and, while it's a
> > little hard to judge, I don't think there is a space between the
> > apostrophes).
> >     So the question is: what is being returned by the blank text box
> > and how should it be checked?
> >     Thanks,
> >            Barney
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Passing blocks through render('partialname')

2011-07-28 Thread Brent
How can I capture the block that I pass through a partial. I want to
be able to do something like:

<%= render 'shared/partialname' do %>
  Misc code / text
<% end %>

Then I want to display that block at a specific place in that partial.
I could do this if I created a method. But I want to know how it works
with partials.

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



[Rails] Re: Actionmailer Help Needed

2011-07-28 Thread Kendall Gifford
On Thursday, July 28, 2011 10:05:01 AM UTC-6, Ruby-Forum.com User wrote:
>
> Hello everyone,
>
> Nice to meet you all, am new to the forum.
>
> I'm stuck with rake / actionmailer trying to display a set of found
> records.
>
> We have a simple actionmailer rake task that is supposed to send a daily
> email digest of tasks that are due for a specific user. So far, it's
> working but the email only displays the first message.
>
> In my task model
>
> scope :tasksdue, lambda {
>where("dueddate > ? AND status = ?", Date.today, false)
>   }
>
>  def self.send_reminders
>   Task.tasksdue.find_each do |task|
>   TaskMailer.deliver_task_due task
>  end
> task_mailer.rb
>
> class TaskMailer < ActionMailer::Base
>   def task_due(task)
>   recipients @task.user.email
>   from   "em...@example.com"
>   subject"Your report entitled"
>   sent_onTime.now
>   content_type "text/html"
>   body   :task => task
>   end
> end
>
> In my rake tasks file I have
>
> namespace :cron do
>   desc "Send email reminders to all users"
>   task :send_reminders => :environment do
> Task.send_reminders
>   end
> end
>
> And in my view, task_due.html.erb, I've tried this.
>
> 
> 
>   
>  />
>   
>   
> Ahoy! <%= @task.responsible %>
> <% Task.send_reminders.each do |report| %>
>   <%= Task.send_reminders.title %>
> <% end %>
>

Yeah, so why are you calling "Task.send_reminders" in your template? I don't 
think this is what you want.
 

>   
>
> This results in a loop, stack level too deep. I think I understand why.
>
Yeah, you've got a recursion loop.

Given you've got at least one Task.tasksdue
When call Task.send_reminders

1. Task.send_reminders calls TaskMailer.deliver_task (passing the task 
instance)
2. TaskMailer.deliver_task results in the rendering of the task_due.html.erb 
template
3. The task_due.html.erb template calls TaskMailer.deliver_task (a.k.a., 
GOTO #1)
 

> Can you help me understand how I display all my records from the found
> set?
>
> All the best
>
> Jenny Bx
>
>
> Do you really want 1 email per matching task? Or do you want one email per 
user who has at least one matching task? Part of your code is written as if 
you want the former while part of it is written as if you want the latter.

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



Re: [Rails] Re: rails mailer and attachments

2011-07-28 Thread Kendall Gifford
On Thu, Jul 28, 2011 at 8:02 AM, Damien Knight  wrote:

> so you think, i have to set the mime-type of each attachment
> manually/explicitly?
>
>
No.

First off, I'd recommend possibly contacting people in the "Ruby's Mail
Discussion Group"

https://groups.google.com/forum/#!forum/mail-ruby

I was saying that the problem *might* be that there are extraneous
"Mime-Version" and "Date" headers at the start of each of the 2 parts of the
multi-part message. These headers are needed ("Date" is required for all
emails and "Mime-Version" is required multi-part messages) at the email
message level (the first chunk of headers before the multi-part sections in
the body). However, these headers are *not* needed in the header sections of
the individual parts of the multi-part message. My theory is that some
clients may (incorrectly) be choking (and not displaying the fact that
you've got an attachment) because of these unnecessary headers.

This is totally a shot in the dark. Without combing through all the
email/multi-part/mime RFCs and doing extensive testing of this theory using
hand-crafted messages in many email clients, I have no way to verify this.

My actual recommendation to you is that you really see if you can somehow
get a communication channel directly to a client that next reports having
this problem. My understanding being that your problem is sporadic. I don't
know how your organization/company is setup and/or how many layers/levels of
organizational/corporate barriers exist to make this difficult or
impossible. But you need to reproduce the problem else all we can do is
speculate.

Perhaps you could include a footer/sub-text on messages w/instructions that
clients contact a specific email address or phone number if they get an
email and they can't see their attachments? Then have at least a few
instances of the next few support requests for this specific problem
redirect to you or your development team. Then you could perhaps talk the
client through the steps necessary to tell you exactly what type and
versions of OS and email client software their running. You could also have
them send the broken message to you by forwarding it as an attachment.

Then you can extract the message and set up a test environment w/the broken
email client software and verify that the forwarded email doesn't "work" in
said client. At this point, using a simple text editor, you could then
*test* theories as to why its broken by making a series of changes (keeping
the original) one at a time to the email and opening it in the broken client
until you isolate the exact aspect of the message causing the client to not
display the attachment.

Only then, once you know what the real problem is, can you get advice as to
what to do using actionmailer and the mail gem to send emails that won't
have the attachment problem.

I sympathize with you. I basically had a very similar problem and had to
solve it for my company using this technique. However, my problem had to do
with Thunderbird not liking the default way the hierarchy of "parts" in our
multi-part messages (as created by the mail gem using the most obvious
message construction code) were constructed/organized. Your example,
however, was a simple "multipart/mixed" mixed message w/a text part and an
attachment. If this is how all your messages are structured (no
"multipart/alternative" stuff) then you've got a different problem that me.

Hope you find what the problem is.

-- 
Kendall Gifford

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



[Rails] RedCloth and sanitizing input

2011-07-28 Thread Jan Marquardt

Hi mates,

I've hit a problem and hope for some advices.

I am developing a blog for my family and I want to provide the 
opportuniy that everyone may format his blog posts. After some research 
I found RedCloth. It seems that it does exactly what I want, but for 
output i need to use the raw helper.


<%= raw RedCloth.new(post.content) %>

But this also allows them to use HTML in their posts. What is the best 
practice to prevent the usage of HTML and sanitize the content in this 
case? Is there any plugin for achiving this?


I'd be thankful for any help.

Kind regards,

Jan

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



[Rails] Re: Can you suggest a fixtures replacement for a MongoDB-based Rails 3.1 project?

2011-07-28 Thread Frederick Cheung


On Jul 28, 7:22 am, Phoenix Rising  wrote:
> Hey guys,
>
> I'm taking the plunge and building a new app on Rails 3.1 (asset
> pipelining ROCKS) and using MongoDB as the backend.  Does anyone know
> of any good fixtures replacements that work with MongoDB and Rails
> 3.1?  I could really use some advice there.
>

I've used factory girl with mongomapper quite happily

Fred
> Also, a follow-up question: the two ODMs I've seen for MongoDB are
> Mongoid and MongoMapper.  I'm hoping to keep as much ActiveRecord-like
> functionality as possible in my application, so which would be
> "closer" to AR?  After looking at both briefly I'm thinking that would
> be MongoMapper, but as I said - I only had time to look *briefly* so
> far - I'd prefer hearing a more experienced opinion.  Additionally, do
> they both perform roughly equally as well, or is one known for being
> more or less efficient than the other?  Are there other ODMs I should
> consider using?
>
> Thanks guys.

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



[Rails] Re: Rendering a json view and HTML characters

2011-07-28 Thread Frederick Cheung


On Jul 28, 5:53 pm, Michael José  wrote:
> Hi there fellows !
>
> I'm currently working on a JSon view and had to make my own view (for
> simple ActiveSupport::JSON can't do the trick anymore).
>
> The thing is, after my controller does this :
>
> respond_to
>   format.html
>   format.json
> end
>
> It does use the correct view in the correct context. Yet, the json view
> is filtered and the unsupported characters of HTML are modified.
>
> So this is pretty much what I get :
>
> {"created_at":"2011-07-28T15:38:36Z"}
>
You're probably being tripped up by rails's automatic html escaping
What's in your view file?
It seems unlikely that you need to go down the root you're going down
- you can build whatever hash you need and then render it as json with
render :json => some_hash.

Fred
> When all I really wanted was :
>
> {"created_at":"2011-07-28T15:38:36Z"}
>
> What's up with that ? How may I prevent this filtering to happen ?
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



Re: [Rails] Nature of Return Values from Search

2011-07-28 Thread Eric Björkvall
Hej

You probably  should check the params hash in the controller:

@skill_search1 = params[:skill1] etc..

Also use a debugger call in the search method to see the
parameters that are passed

def search
 debugger
 . 
 . 
end

Cheers,
Eric


On 28 jul 2011, at 22.03, Barney wrote:

> Hello,
> I'm trying the search method used in the Guides:
> http://guides.rubyonrails.org/form_helpers.html
> and I don't know what is coming back to the controller when a text box
> is empty.  When each of the 2 text boxes (described below) have a
> value then the search works.  However, if the second box is empty then
> nothing is returned, even though there is data to match the first box.
> The boxes are formed in the search.html.erb as:
> 
> <%= form_tag({controller => "people", :action => "search"}, :method =>
> "get" ) do %>
>  <%= label_tag(:skill1, "Search Skills for:") %>
>  <%= text_field_tag(:skill1) %>
>  <%= text_field_tag(:skill2) %>
>  <%= submit_tag("Search") %>
> <% end %>
> 
> And are read in the controller by:
> 
> def search
>@people = Person.all
>@skill_search1 = String.new
>@skill_search1=:skill1.to_s
>@skill_search2 = String.new
>@skill_search2=:skill2.to_s
> 
>if @skill_search2.empty?
>  @found_people = Person.where("skill_set LIKE ?",
> params[@skill_search1])
>else
>  @found_people = Person.where("skill_set LIKE ? and skill_set
> LIKE ?", params[@skill_search1],params[@skill_search2])
>end
>  end
> 
> I have also tried: if @skill_search2  == NUL, ==  " ",== nil,
> =='' and ="" under the theory that if you type in everything then
> something might work (hey, it's worked in the past!).
> 
> Looking at the output in the command window that is used for the
> "rails server" call to WEBRick it seems that the second conditional
> option is always called and the statement ends in "and skill_set LIKE
> ''"   (that is 2 apostrophes before the final quote and, while it's a
> little hard to judge, I don't think there is a space between the
> apostrophes).
> So the question is: what is being returned by the blank text box
> and how should it be checked?
> Thanks,
>Barney
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

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



Re: [Rails] Rails, jquery and Ajax

2011-07-28 Thread Eric Björkvall
One way:

link_to "#", new_comment_path, :remote => true, :id => "new-comment-link"

new.js.erb

$(#new-comment-link).hide();
 $('#commentlist').html('<%= render :partial => "comments" %>')


You can use ruby logic in the .js.erb file - just like you could in former .rjs 
files.

<% if @condition %>
 alert("condition <%= @condition %>");
<% end %>



Cheers,
Eric




On 27 jul 2011, at 13:45, Paul Bergstrom wrote:

> How do I make an ajax call and then update a div with a partial? I've
> tried this but it's not working. Comment is created but the partial is
> not loaded.
> 
> //view
>  Testlink
>  
> 
>  
> 
> //controller
>  def new
> 
>  @comment = Comment.new
>  @comment.save
> 
>  respond_to do |format|
>format.html { }
>format.js { }
>  end
> 
>  end
> 
> //js
> $(function() {
> 
>  $('#testlink').click(function() {
>$.ajax({
>   type: "GET",
>   url: "/comments/new",
>   success: function(){
>$('#commentlist').html('<%= render :partial => "comments" %>')
> 
>   }
>});
>  });
> });
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

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



[Rails] goldsmiths ma/msc in creating social media: a hacktivist approach

2011-07-28 Thread dan mcquillan
some of the rails community may be interested in this new ma/msc from
goldsmiths:
http://www.gold.ac.uk/pg/ma-creating-social-media/
the cultural studies part focuses on theory and practice that enables
new forms of social media, and the computing part leans heavily
towards hacking and social media software. we see rails as one of the
core technologies for this.

happy to field questions directly
dan

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



[Rails] Nature of Return Values from Search

2011-07-28 Thread Barney
Hello,
 I'm trying the search method used in the Guides:
http://guides.rubyonrails.org/form_helpers.html
and I don't know what is coming back to the controller when a text box
is empty.  When each of the 2 text boxes (described below) have a
value then the search works.  However, if the second box is empty then
nothing is returned, even though there is data to match the first box.
 The boxes are formed in the search.html.erb as:

<%= form_tag({controller => "people", :action => "search"}, :method =>
"get" ) do %>
  <%= label_tag(:skill1, "Search Skills for:") %>
  <%= text_field_tag(:skill1) %>
  <%= text_field_tag(:skill2) %>
  <%= submit_tag("Search") %>
<% end %>

And are read in the controller by:

 def search
@people = Person.all
@skill_search1 = String.new
@skill_search1=:skill1.to_s
@skill_search2 = String.new
@skill_search2=:skill2.to_s

if @skill_search2.empty?
  @found_people = Person.where("skill_set LIKE ?",
params[@skill_search1])
else
  @found_people = Person.where("skill_set LIKE ? and skill_set
LIKE ?", params[@skill_search1],params[@skill_search2])
end
  end

 I have also tried: if @skill_search2  == NUL, ==  " ",== nil,
=='' and ="" under the theory that if you type in everything then
something might work (hey, it's worked in the past!).

 Looking at the output in the command window that is used for the
"rails server" call to WEBRick it seems that the second conditional
option is always called and the statement ends in "and skill_set LIKE
''"   (that is 2 apostrophes before the final quote and, while it's a
little hard to judge, I don't think there is a space between the
apostrophes).
 So the question is: what is being returned by the blank text box
and how should it be checked?
 Thanks,
Barney

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



[Rails] Unable to change Font

2011-07-28 Thread Yennie
Hi,

I have a problem to set up the language
I did use

@font-face {
  font-family: english;
  src: url("<%= current_language.get_font_url %>")
format('truetype');
  }
  html {
font-family: english;
  }

%= current_language.get_font_url  => app_data/language_english/
font.ttf

but it does not change the current font.
can anyone help me..

Thanks

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



[Rails] Re: Rails, jquery and Ajax

2011-07-28 Thread Eric Björkvall
One way:

link_to "#", new_comment_path, :remote => true, :id => 
"new-comment-link"

new.js.erb

$(#new-comment-link).hide();
$('#commentlist').html('<%= render :partial => "comments" %>')


You can use ruby logic in the .js.erb file - just like you could in 
former .rjs files.

<% if @condition %>
alert("condition <%= @condition %>");
<% end %>



Cheers,
Eric

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

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



[Rails] Re: Help install jquery ui

2011-07-28 Thread Robert Walker
Rodrigo Ruiz wrote in post #1013597:
> I tryed rails generate jquery:install --ui but my draggable method still
> does nothing.

Have you tried any of the browser developer tools to make sure 
jquery-ui.???.js is getting loaded. If you're using FireFox then FireBug 
is good for that. If you're using a WebKit based browser (Safari or 
Chrome) then they have the built-in Web Inspector. With any of those 
tools select the "Resources" tab and look for the JavaScript files 
downloaded by the browser. That will tell you if jQuery UI is getting 
loaded correctly. If it is getting downloaded these tools also have 
JavaScript debuggers built into them, which allow you to set breakpoints 
and step through execution of JavaScript.

It would serve you well to learn how to use these tools.

> What is the proper way to install jquery ui (specially for dragging
> elements)?

They same way you install any JavaScript files in Rails. Put them in the 
proper place and make sure your layout (or whatever renders the  
tags) loads the required JavaScript files.

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

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



[Rails] Re: Rails, jquery and Ajax

2011-07-28 Thread wilson
Railscasts has some examples:

http://railscasts.com/episodes/43-ajax-with-rjs
http://railscasts.com/episodes/136-jquery

On 27 jul, 08:45, Paul Bergstrom  wrote:
> How do I make an ajax call and then update a div with a partial? I've
> tried this but it's not working. Comment is created but the partial is
> not loaded.
>
> //view
>       Testlink
>       
>
>       
>
> //controller
>   def new
>
>       @comment = Comment.new
>       @comment.save
>
>       respond_to do |format|
>         format.html { }
>         format.js { }
>       end
>
>   end
>
> //js
> $(function() {
>
>   $('#testlink').click(function() {
>     $.ajax({
>        type: "GET",
>        url: "/comments/new",
>        success: function(){
>         $('#commentlist').html('<%= render :partial => "comments" %>')
>
>        }
>     });
>   });
>
> });
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Help install jquery ui

2011-07-28 Thread Rodrigo Ruiz
I tryed rails generate jquery:install --ui but my draggable method still
does nothing.

Can anyone help me ?

What is the proper way to install jquery ui (specially for dragging
elements)?

Thank you,
Rodrigo

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



[Rails] [JSon] Rendering a json view and HTML characters

2011-07-28 Thread Michael José
Hi there fellows !

I'm currently working on a JSon view and had to make my own view (for
simple ActiveSupport::JSON can't do the trick anymore).

The thing is, after my controller does this :

respond_to
  format.html
  format.json
end

It does use the correct view in the correct context. Yet, the json view
is filtered and the unsupported characters of HTML are modified.

So this is pretty much what I get :

{"created_at":"2011-07-28T15:38:36Z"}

When all I really wanted was :


{"created_at":"2011-07-28T15:38:36Z"}

What's up with that ? How may I prevent this filtering to happen ?

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

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



[Rails] Actionmailer Help Needed

2011-07-28 Thread Jenny Blunt
Hello everyone,

Nice to meet you all, am new to the forum.

I'm stuck with rake / actionmailer trying to display a set of found
records.

We have a simple actionmailer rake task that is supposed to send a daily
email digest of tasks that are due for a specific user. So far, it's
working but the email only displays the first message.

In my task model

scope :tasksdue, lambda {
   where("dueddate > ? AND status = ?", Date.today, false)
  }

 def self.send_reminders
  Task.tasksdue.find_each do |task|
  TaskMailer.deliver_task_due task
 end
task_mailer.rb

class TaskMailer < ActionMailer::Base
  def task_due(task)
  recipients @task.user.email
  from   "em...@example.com"
  subject"Your report entitled"
  sent_onTime.now
  content_type "text/html"
  body   :task => task
  end
end

In my rake tasks file I have

namespace :cron do
  desc "Send email reminders to all users"
  task :send_reminders => :environment do
Task.send_reminders
  end
end

And in my view, task_due.html.erb, I've tried this.



  

  
  
Ahoy! <%= @task.responsible %>
<% Task.send_reminders.each do |report| %>
  <%= Task.send_reminders.title %>
<% end %>
  

This results in a loop, stack level too deep. I think I understand why.
Can you help me understand how I display all my records from the found
set?

All the best

Jenny Bx

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

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



[Rails] Re: Active Record track changes with update_attributes

2011-07-28 Thread Owain

> You could do order.attributes = params[:order], inspect the changes
> and then save the object.
>
> Fred

@fred that worked perfectly.

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



Re: [Rails] starter question about paperclip / relations in rails 3

2011-07-28 Thread Alejandro Cadavid
Hey

When you do (user.assets.each do |assetfield|) you are getting each Asset
object associated to user in the assetfield variable, but still you need to
access the attachment property which is 'asset'. So basically you just need
to change assetfield.url(:thumb) for assetfield.asset.url(:thumb) and it
should work fine. Check that this is done in the edit form
as asset_fields.object.asset.url(:thumb) (where asset_fields.object
represents the same Asset object as assetfield)

Hope this helps. Good luck!

On Thu, Jul 28, 2011 at 5:34 AM, Daniel Amsterdam  wrote:

> Hello,
>
> i'm trying out Rails 3 and i've created a little app with paperclip.
> My problem is that i cant get the assets for a user in the index
> action but in the edit action it works. i have the flowing set up
>
> class User
>  has_many :assets
>
> class Asset
>   belongs_to :user
>   has_attached_file :asset,
>:styles => { :medium => "300x300>",
> :thumb => "100x100>" }
>
> --
>
> In my edit action i can get the assets for the user easy by doing:
>
><% f.fields_for :assets do |asset_fields| %>
>
><% unless asset_fields.object.new_record? %>
>
>
><%= link_to
> image_tag(asset_fields.object.asset.url(:thumb)),
> asset_fields.object.asset.url(:original) %>
><%= f.label :destroy, 'Verwijder'
> %>
><%= asset_fields.check_box(:_destroy)
> %>
>
><% end %>
><% end %>
>
> Now in my index action i want to display the user.assets also but i
> get the error undefined method `url' for xx
>
> in the user controler i get the users by
>@users = User.all(:include => :assets)
>#@users = User.all()
>
> in the view i have
><% @users.each do |user| %>
>
><%= user.firstname %><%= user.lastname %>
><%= debug(user) %>
><% unless current_user.nil? %>
><% if current_user.id == user.id %>
><%= link_to "Edit",
> edit_user_path(user) %>
><% end %>
><% end %>
><%= debug(user.assets) %>
><% user.assets.each do |assetfield| %>
><%= assetfield.url(:thumb) %>
><% end %>
>
>
><% end %>
>
> and i get the error undefined method `url' for # 0x01058cce08> so the asset object is not there i gues. I'm having
> trouble to understand whats wrong because the realtion is fine. I hop
> somebody here can help me understand this and help me out?
>
> 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-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Looking for a fellow human: Agile, Mobile, Web, Rails Developer

2011-07-28 Thread zdennis
Not to spam the list, but I thought the Rails community may be
appropriate to tap into.

We're looking for agilist web/mobile developer(s) over at Mutually
Human:

http://mutuallyhuman.com/blog/2011/07/28/looking-for-a-fellow-human-agile-mobile-web-rails-developer

If you or anyone you know may be interested, we'd love to talk to you,

--
Zach Dennis
http://www.mutuallyhuman.com
@mutuallyhuman (twitter)

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



[Rails] Trouble connecting to JDE Database using Watir in Ruby

2011-07-28 Thread Stephen Beckman
Hello folks,

I have been testing out Watir developed on the Ruby platform to make
some automated tests for JD Edwards on E1(Enterprise software suite). We
are using SQL Server and I am having trouble connecting to the database
here using ActiveRecord (based off of Rails). So far I have the script
working for the E1 side of it, clicking buttons, entering fields, and
using it as we need it to for our tests. We now need it to make calls to
the database.

So far I have isolated my code for what should be connecting to the
database and checking to see if it will connect at all without any
queries. What I cannot discover on Google or any of the manuals I have
looked in is the correct ':database' and ':host' parameters for a JDE
server.



Code:

require 'rubygems'
gem 'activerecord'
require 'active_record'
gem 'activerecord-odbc-adapter'
require 'odbc'

ActiveRecord::Base.establish_connection(
  :adapter  =>  "odbc",
  :dsn => "E900",
  :server => "IDAUTILDB\\E900",
  :database => "",
  :username =>  "",
  :password =>  "",
  :trusted_connection => "true"
)

puts ActiveRecord::Base.connected?

class TESTDTA < ActiveRecord::Base
end

class NCDOCO < TESTDTA
end



I have been looking for answers for several days now through google and
I have seen all the variations in the credentials above, but I do not
have an accurate repository for what should go in there apparently
because I have tried 20-30 different combinations of credentials that
should work but don't.  I have also tried it with ODBC and DBI.  Neither
of which worked any better.

Any help will be appreciated immensely, thanks in advance!

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

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



[Rails] Re: Problem redirecting from a js call

2011-07-28 Thread A . Fernández
Found how to do it.

window.location.replace( url-to-go ); in the template. Was looking to
do this inside the controller but this works too.

Thanks!

On 28 jul, 11:30, A. Fernández  wrote:
> Hi all,
>
> I have a form that uses ajax to add a product to a cart. After all
> verifications it must redirect to the product page again.
>
> When I call the js, it makes all the verifications, if one fails, it
> renders them in a specific div with the explanation, but if there are
> no errors, it must redirect to the product again, so I used the
> typical:
>
> redirect_to @product
>
> but since it was a js call the redirect tryes to render the js
> template for @product but it not exists since it's only html.
>
> So, ¿how can I tell redirect_to to render the html format instead of
> the js format on the redirection?
>
> So many thanks in advance.
>
> Antonio
>
> Sorry if my English it's not good enough, I try my best :)

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



Re: [Rails] Re: Rails 3.1 Engines: Full vs. Mountable

2011-07-28 Thread Paul
I'm interested in this, too, but I haven't used 3.1 yet. Let us know
what you find out!

On Thu, Jul 28, 2011 at 9:11 AM, astjohn  wrote:
> I take it no one has poked around with the Rails 3.1 engines yet?

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



[Rails] Re: rails mailer and attachments

2011-07-28 Thread Damien Knight
so you think, i have to set the mime-type of each attachment 
manually/explicitly?

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

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



[Rails] Re: Deploying RoR apps from different branches

2011-07-28 Thread BirdieTracker
I'm stuck with SVN (enterprise requirement) but not stuck with Vlad.
I'll check out Cap and see if that makes my like easier.

Thanks for the feedback everyone.


On Jul 27, 8:46 am, dsadaka  wrote:
> I use capistrano and I don't have to worry about any of that.
> Sure it copies the branch to a "cached" area on the web server as well
> as to the live area.
> Setup is very simple.  Have you tried it?
>
> HTH,
> D
>
> On Jul 26, 10:59 am, BirdieTracker  wrote:
>
>
>
>
>
>
>
> > I have a multi-environment configuration (local, staging, development)
> > in which I can deploy the same branch (ie...trunk) to with ease using
> > Vlad the Deployer.  I'm struggling to figure out how to deploy a new
> > branch to my staging environment, without having to check out the
> > entire repository (subversion) onto the staging server.
>
> > Has anyone run into this problem and solved it?
>
> > Am I complicating things for myself?  If so, what is a better way to
> > manage branches and deployments to various environments?
>
> > Thanks!
> > Ron
>
> > PS...I'm open to switching to a new deployment tool.

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



[Rails] Re: Question regarding associations..

2011-07-28 Thread Frederick Cheung


On Jul 28, 2:53 pm, Rick & Nellie Flower  wrote:
> Thanks guys!  I'll play with this some more when I come home this evening..
>
> One more question if I could.. If I get the plumbing all plugged in as 
> needed, do I ned to do
> anything in particular with the view for the address object to get it to show 
> up when adding or
> editing a user record or will it get pulled in automagically?  Just curious. 
> Thanks!
>

accepts_nested_attributes_for is your friend for this one.

Fred
> I'm still trying to figure this all out in my head!
>
> On Jul 28, 2011, at 12:43 AM, Chris Kottom wrote:
>
>
>
> > You don't have a FK for user_id in your ADDRESSES table for starters, and 
> > you didn't include your model files, so there's no way of knowing whether 
> > you've defined the relationships there.
>
> > See:
> >http://guides.rubyonrails.org/migrations.html
> >http://guides.rubyonrails.org/association_basics.html
>
> > On Thu, Jul 28, 2011 at 8:53 AM, Rick & Nellie Flower  
> > wrote:
> > Ok.. So I've got my initial table structures setup and I was hoping I could 
> > have associations help me out with something akin to embedded/nested 
> > objects but without the direct nesting (unless there's another way to 
> > achieve that goal)..
>
> > So, I've got an Address class that looks like the following :
>
> > class CreateAddresses < ActiveRecord::Migration
> >  belongs_to :user
>
> >  def self.up
> >    create_table :addresses do |t|
> >      t.string :address
> >      t.string :city
> >      t.string :state
> >      t.string :zip
> >      t.string :email
> >      t.string :phone
>
> >      t.timestamps
> >    end
> >  end
>
> >  def self.down
> >    drop_table :addresses
> >  end
> > end
> > 
> > I've then got a user class that looks like the following :
>
> > class CreateUsers < ActiveRecord::Migration
> >  has_one :address
>
> >  def self.up
> >    create_table :users do |t|
> >      t.srting      :name
> >      t.boolean  :isProfileSetup
> >      t.datetime :lastLogin
> >      t.string   :password
> >      t.string   :securityQ
> >      t.string   :securityA
> >      t.string   :username
>
> >      t.timestamps
> >    end
> >  end
>
> >  def self.down
> >    drop_table :users
> >  end
> > end
>
> > I was hoping I could do something like the following in the rails console 
> > and have it work
> > but it does not:
>
> > => @user=User.create
> > =>@ci...@user.address.city
>
> > Any ideas on whether I'm barking up the wrong tree with associations -- 
> > perhaps using
> > the wrong syntax or is it even possible with what I want to do?  I feel 
> > like they ought to work
> > but…
>
> > Any ideas?? Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



Re: [Rails] Question regarding associations..

2011-07-28 Thread Rick & Nellie Flower
Thanks guys!  I'll play with this some more when I come home this evening.. 

One more question if I could.. If I get the plumbing all plugged in as needed, 
do I ned to do
anything in particular with the view for the address object to get it to show 
up when adding or
editing a user record or will it get pulled in automagically?  Just curious. 
Thanks!

I'm still trying to figure this all out in my head!

On Jul 28, 2011, at 12:43 AM, Chris Kottom wrote:

> You don't have a FK for user_id in your ADDRESSES table for starters, and you 
> didn't include your model files, so there's no way of knowing whether you've 
> defined the relationships there.
> 
> See:
> http://guides.rubyonrails.org/migrations.html
> http://guides.rubyonrails.org/association_basics.html
> 
> On Thu, Jul 28, 2011 at 8:53 AM, Rick & Nellie Flower  
> wrote:
> Ok.. So I've got my initial table structures setup and I was hoping I could 
> have associations help me out with something akin to embedded/nested objects 
> but without the direct nesting (unless there's another way to achieve that 
> goal)..
> 
> So, I've got an Address class that looks like the following :
> 
> class CreateAddresses < ActiveRecord::Migration
>  belongs_to :user
> 
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
> 
>  t.timestamps
>end
>  end
> 
>  def self.down
>drop_table :addresses
>  end
> end
> 
> I've then got a user class that looks like the following :
> 
> class CreateUsers < ActiveRecord::Migration
>  has_one :address
> 
>  def self.up
>create_table :users do |t|
>  t.srting  :name
>  t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
> 
>  t.timestamps
>end
>  end
> 
>  def self.down
>drop_table :users
>  end
> end
> 
> I was hoping I could do something like the following in the rails console and 
> have it work
> but it does not:
> 
> => @user=User.create
> =>@city=@user.address.city
> 
> Any ideas on whether I'm barking up the wrong tree with associations -- 
> perhaps using
> the wrong syntax or is it even possible with what I want to do?  I feel like 
> they ought to work
> but…
> 
> Any ideas?? Thanks!
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: autocomplete depending on input of another field

2011-07-28 Thread Angelo Cordova
Thanks for your answer
do you have any link to a site with examples or something like that
I really don't know much about ajax

On Jul 28, 1:20 am, Chirag Shah  wrote:
> You can call ajax request on change or on lost focus of the code field
> For send ajax request you can do observe_field or use remote_function
>
> - Chirag Shahhttp://blogofchirag.blogspot.com/
>
> Angelo Cordova wrote in post #1013448:
>
>
>
>
>
>
>
>
>
> > Hello everyone
>
> > I have the following problem.
>
> > I have a model name "products"
>
> > Products
> > -id (by default)
> > -code
> > -name
> > -description
> > -quantity
>
> > and in one of the forms I need that if I write the code, the others
> > fields be filled automatically with the right value.
>
> > How can I do this?? any gem??
>
> > Hope you can help me
>
> > Thanks
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: Gem problems

2011-07-28 Thread Frederick Cheung


On Jul 28, 1:32 pm, Rob Biedenharn  wrot>
On Jul 28, 2011, at 1:13 AM, Chirag Shah wrote:
> >> Is there any way around this? Has anyone else had this problem
>
> No.
>
> ~> 1.4.4 means:  >= 1.4.4 and < 1.5
> 1.5.0 means:     = 1.5.0
>
> So there's no way to have a single version of nokogiri that can  
> simultaneously satisfy both version contraints.

Other than forking aws-sdk, seeing if it is compatible with nokogiri
1.5 and if it is changing the version in the dependency

Fred

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



[Rails] Re: Rails 3.1 Engines: Full vs. Mountable

2011-07-28 Thread astjohn
I take it no one has poked around with the Rails 3.1 engines yet?


-Adam

On Jul 25, 3:27 pm, astjohn  wrote:
> Hi all,
>
> I was hoping someone could please clarify the differences between a
> full engine and a mountable one.
>
> I have noticed the following:
>
> ** Full Engine **
> - With a full engine, the parent application inherits the routes from
> the engine.  It is not necessary to specify anything in parent_app/
> config/routes.rb.  Specifying the gem in Gemfile is enough.  The
> engine routes are specified as:
>
> # my_engine/config/routes.rb
> Rails.application.routes.draw do
> # whatever
> end
>
> - No namespacing of models, controllers, etc.  These are immediately
> accessible to the parent application.
>
> ** Mountable Engine **
> - The engine's namespace is isolated by default.
>
> # my_engine/lib/my_engine/engine.rb
> module MyEngine
>   class Engine < Rails::Engine
>     isolate_namespace MyEngine
>   end
> end
>
> - With a mountable engine, the routes are namespaced and the parent
> app can bundle this functionality under a single route:
>
> # my_engine/config/routes.rb
> MyEngine::Engine.routes.draw do
> #whatever
> end
>
> # parent_app/config/routes.rb
> Rails.application.routes.draw do
>   mount MyEngine::Engine => "/engine", :as => "namespaced"
> end
>
> - Models, controllers, etc are isolated from the parent application -
> although helpers can be shared easily.
>
> Is this correct and are these the main differences?  Are there any
> other differences between a full and mountable engine that I missed?
>
> Thanks,
> Adam

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



Re: [Rails] How to move html element?

2011-07-28 Thread Walter Lee Davis

Have a look at the Scriptaculous Draggable library. http://script.aculo.us

This is built in to Rails < 3.1. I'm sure there's similar in jQuery  
for Rails >= 3.1.


Walter

On Jul 28, 2011, at 8:31 AM, Rodrigo Ruiz wrote:

Does anyone knows how to make an image, or anything that I draw on  
my page, to move by dragging with mouse?

Is there a rails way to do it? if not, is there any way to do this?

Thank you,
Rodrigo


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



Re: [Rails] Migration to rails2 rails3

2011-07-28 Thread Chirag Singhal
Great, copy over the changes and post again if you get stuck anywhere else.


Chirag
http://sumeruonrails.com



On Thu, Jul 28, 2011 at 5:39 PM, Rodrigo Martins wrote:

> Chirag, Thank you,
>
> Differences between the Rakefile to rails2 rails3.
>
> Rails2 the Rakefile:
> require(File.join(File.dirname(__FILE__), 'config', 'boot'))
> require '...'
>
> Rails3 the Rakefile:
> require File.expand_path('../config/application', __FILE__)
> ::Application.load_tasks
>
> brother won ...
>
> link:
> http://stackoverflow.com/questions/3953275/heroku-rake-dbmigrate-fails-missing-tasks-rails
>
>
>
>  --
> * Atenciosamente*
> ___
> Rodrigo Martins
>  www.rrmartins.com
>
> tel: (28) 9882-6202
>   (27) 9601-9573
>
>
> My profiles: [image: Facebook]  
> [image:
> Twitter] 
> Contact me: [image: Google Talk/] rodr...@rrmartins.com [image: 
> Skype/]rr_martinsj [image:
> MSN/] rodr...@rrmartins.com
>
>
>
>
> On Thu, Jul 28, 2011 at 1:00 AM, Chirag Singhal 
> wrote:
>
>> Everything looks good here.
>> What all did you do when upgrading from rails 2 to rails 3?
>> There are a lot of changes in the script and config folders between the
>> two versions.
>>
>> Generate a new rails3 app, copy over everything from the script folder
>> into script folder of your app.
>> Then try installing the plugin again with:
>>
>> ruby script/rails plugin install git://github.com/rails/rails_upgrade.git
>>
>> No need to use sudo with the command, unless your application directory is
>> owned by root.
>>
>>
>> Chirag
>> http://sumeruonrails.com
>>
>>
>>
>> On Wed, Jul 27, 2011 at 7:54 PM, Rodrigo Martins 
>> wrote:
>>
>>> Attached files
>>>
>>>
>>>
>>>  --
>>> * Atenciosamente*
>>> ___
>>> Rodrigo Martins
>>>  www.rrmartins.com
>>>
>>> tel: (28) 9882-6202
>>>   (27) 9601-9573
>>>
>>>
>>> My profiles: [image: Facebook]  
>>> [image:
>>> Twitter] 
>>> Contact me: [image: Google Talk/] rodr...@rrmartins.com [image: 
>>> Skype/]rr_martinsj [image:
>>> MSN/] rodr...@rrmartins.com
>>>
>>>
>>>
>>>
>>> On Wed, Jul 27, 2011 at 10:27 AM, Chirag Singhal <
>>> chirag.sing...@gmail.com> wrote:
>>>
 Can you attach your config/environment.rb file and Gemfile?


 Chirag
 http://sumeruonrails.com



 On Wed, Jul 27, 2011 at 5:43 PM, Rodrigo Martins >>> > wrote:

> when I run the first command you gave me appears the help of the rails,
> and apparently does not install, and the second an error.
>
> I put down the errors and the versions of ruby and rails.
>
> rodrigo@rrmartins:~/Documentos/vota_prato2$ sudo ruby script/rails
> plugin install git://github.com/rails/rails_upgrade.git
> ruby: No such file or directory -- script/rails (LoadError)
> rodrigo@rrmartins:~/Documentos/vota_prato2$ sudo rails plugin install
> git://github.com/rails/rails_upgrade.git
> Usage:
>   rails new APP_PATH [options]
>
> Options:
>   -r, [--ruby=PATH]   # Path to the Ruby binary of your choice
>   # Default: /usr/local/bin/ruby
>   -d, [--database=DATABASE]   # Preconfigure for selected database
> (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
>   # Default: sqlite3
>   -b, [--builder=BUILDER] # Path to an application builder (can be
> a filesystem path or URL)
>   -m, [--template=TEMPLATE]   # Path to an application template (can be
> a filesystem path or URL)
>   [--dev] # Setup the application with Gemfile
> pointing to your Rails checkout
>   [--edge]# Setup the application with Gemfile
> pointing to Rails repository
>   [--skip-gemfile]# Don't create a Gemfile
>   -O, [--skip-active-record]  # Skip Active Record files
>   -T, [--skip-test-unit]  # Skip Test::Unit files
>   -J, [--skip-prototype]  # Skip Prototype files
>   -G, [--skip-git]# Skip Git ignores and keeps
>
> Runtime options:
>   -f, [--force]# Overwrite files that already exist
>   -p, [--pretend]  # Run but do not make any changes
>   -q, [--quiet]# Supress status output
>   -s, [--skip] # Skip files that already exist
>
> Rails options:
>   -v, [--version]  # Show Rails version number and quit
>   -h, [--help] # Show this help message and quit
>
> Description:
> The 'rails new' command creates a new Rails application with a
> default
> directory structure and configuration at the path you specify.
>
> Example:
> rails new ~/Code/Ruby/weblog
>
> This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
> See the README in the newly created application to get going.
>

Re: [Rails] Re: Gem problems

2011-07-28 Thread Rob Biedenharn

On Jul 28, 2011, at 1:13 AM, Chirag Shah wrote:


Have you installed both nokogiri versions to your machine ?

Brian Jakovich wrote in post #1013456:

Trying to use cabybara and aws's ruby gem and I'm getting this error:

*Bundler could not find compatible versions for gem "nokogiri":

 In Gemfile:
   aws-sdk depends on
 nokogiri (~> 1.4.4)

   capybara depends on
 nokogiri (1.5.0)*



Is there any way around this? Has anyone else had this problem



No.

~> 1.4.4 means:  >= 1.4.4 and < 1.5
1.5.0 means: = 1.5.0

So there's no way to have a single version of nokogiri that can  
simultaneously satisfy both version contraints.


-Rob

Rob Biedenharn  
r...@agileconsultingllc.com http://AgileConsultingLLC.com/
r...@gaslightsoftware.com   http://GaslightSoftware.com/

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



[Rails] How to move html element?

2011-07-28 Thread Rodrigo Ruiz
Does anyone knows how to make an image, or anything that I draw on my page,
to move by dragging with mouse?
Is there a rails way to do it? if not, is there any way to do this?

Thank you,
Rodrigo

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



Re: [Rails] Migration to rails2 rails3

2011-07-28 Thread Rodrigo Martins
Chirag, Thank you,

Differences between the Rakefile to rails2 rails3.

Rails2 the Rakefile:
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require '...'

Rails3 the Rakefile:
require File.expand_path('../config/application', __FILE__)
::Application.load_tasks

brother won ...

link:
http://stackoverflow.com/questions/3953275/heroku-rake-dbmigrate-fails-missing-tasks-rails


 --
* Atenciosamente*
___
Rodrigo Martins
 www.rrmartins.com

tel: (28) 9882-6202
  (27) 9601-9573


My profiles: [image: Facebook]  [image:
Twitter] 
Contact me: [image: Google Talk/] rodr...@rrmartins.com [image:
Skype/]rr_martinsj [image:
MSN/] rodr...@rrmartins.com




On Thu, Jul 28, 2011 at 1:00 AM, Chirag Singhal wrote:

> Everything looks good here.
> What all did you do when upgrading from rails 2 to rails 3?
> There are a lot of changes in the script and config folders between the two
> versions.
>
> Generate a new rails3 app, copy over everything from the script folder into
> script folder of your app.
> Then try installing the plugin again with:
>
> ruby script/rails plugin install git://github.com/rails/rails_upgrade.git
>
> No need to use sudo with the command, unless your application directory is
> owned by root.
>
>
> Chirag
> http://sumeruonrails.com
>
>
>
> On Wed, Jul 27, 2011 at 7:54 PM, Rodrigo Martins wrote:
>
>> Attached files
>>
>>
>>
>>  --
>> * Atenciosamente*
>> ___
>> Rodrigo Martins
>>  www.rrmartins.com
>>
>> tel: (28) 9882-6202
>>   (27) 9601-9573
>>
>>
>> My profiles: [image: Facebook]  
>> [image:
>> Twitter] 
>> Contact me: [image: Google Talk/] rodr...@rrmartins.com [image: 
>> Skype/]rr_martinsj [image:
>> MSN/] rodr...@rrmartins.com
>>
>>
>>
>>
>> On Wed, Jul 27, 2011 at 10:27 AM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> Can you attach your config/environment.rb file and Gemfile?
>>>
>>>
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>>
>>>
>>> On Wed, Jul 27, 2011 at 5:43 PM, Rodrigo Martins 
>>> wrote:
>>>
 when I run the first command you gave me appears the help of the rails,
 and apparently does not install, and the second an error.

 I put down the errors and the versions of ruby and rails.

 rodrigo@rrmartins:~/Documentos/vota_prato2$ sudo ruby script/rails
 plugin install git://github.com/rails/rails_upgrade.git
 ruby: No such file or directory -- script/rails (LoadError)
 rodrigo@rrmartins:~/Documentos/vota_prato2$ sudo rails plugin install
 git://github.com/rails/rails_upgrade.git
 Usage:
   rails new APP_PATH [options]

 Options:
   -r, [--ruby=PATH]   # Path to the Ruby binary of your choice
   # Default: /usr/local/bin/ruby
   -d, [--database=DATABASE]   # Preconfigure for selected database
 (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
   # Default: sqlite3
   -b, [--builder=BUILDER] # Path to an application builder (can be a
 filesystem path or URL)
   -m, [--template=TEMPLATE]   # Path to an application template (can be
 a filesystem path or URL)
   [--dev] # Setup the application with Gemfile
 pointing to your Rails checkout
   [--edge]# Setup the application with Gemfile
 pointing to Rails repository
   [--skip-gemfile]# Don't create a Gemfile
   -O, [--skip-active-record]  # Skip Active Record files
   -T, [--skip-test-unit]  # Skip Test::Unit files
   -J, [--skip-prototype]  # Skip Prototype files
   -G, [--skip-git]# Skip Git ignores and keeps

 Runtime options:
   -f, [--force]# Overwrite files that already exist
   -p, [--pretend]  # Run but do not make any changes
   -q, [--quiet]# Supress status output
   -s, [--skip] # Skip files that already exist

 Rails options:
   -v, [--version]  # Show Rails version number and quit
   -h, [--help] # Show this help message and quit

 Description:
 The 'rails new' command creates a new Rails application with a
 default
 directory structure and configuration at the path you specify.

 Example:
 rails new ~/Code/Ruby/weblog

 This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
 See the README in the newly created application to get going.
 rodrigo@rrmartins:~/Documentos/vota_prato2$ rails -v
 Rails 3.0.9
 rodrigo@rrmartins:~/Documentos/vota_prato2$ ruby -v
 ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]



   --
 * Atenciosamente*
 ___
 Rodrigo Martins
  www.rrmartins.com

 tel: (28) 9882-6202
   (27)

[Rails] Problem redirecting from a js call

2011-07-28 Thread A . Fernández
Hi all,

I have a form that uses ajax to add a product to a cart. After all
verifications it must redirect to the product page again.

When I call the js, it makes all the verifications, if one fails, it
renders them in a specific div with the explanation, but if there are
no errors, it must redirect to the product again, so I used the
typical:

redirect_to @product

but since it was a js call the redirect tryes to render the js
template for @product but it not exists since it's only html.

So, ¿how can I tell redirect_to to render the html format instead of
the js format on the redirection?

So many thanks in advance.

Antonio



Sorry if my English it's not good enough, I try my best :)

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



Re: [Rails] Error while starting Rails. Please help.

2011-07-28 Thread Amit Bobade
Hi Manivannan,
Thanks for your reply. I was using mysql2 and now I changed it to mysql. Now
there is no error, everything is working fine. I am new to ruby, hoping for
you help in future.

Thanks,
-Amit


On Thu, Jul 28, 2011 at 3:58 PM, Manivannan Sivaprakasam <
manisiv...@gmail.com> wrote:

> Hi amit,
>   Please tell me the gem you gave for mysql in Gemfile. (any
> versions?)
>
> On Thu, Jul 28, 2011 at 2:48 PM, Amit Bobade  wrote:
>
>> *Dear all:*
>>
>> I am trying to start rails but it is not getting started. It is giving
>> following error:
>>
>> <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
>> listed in your Gemfile. <-[0m
>>
>> I used following commands for app:
>>
>> *rails new myapp -d mysql
>>
>> *after successfully executing this command  I run command* *to* *start
>> rails.
>> *
>> ruby* *script/rails server *
>>
>> but it is showing error: *<-[31mCould not find gem 'mysql112 (~> 0.2.6)'
>> in any of the gem sources listed in your Gemfile. <-[0m*
>>
>> Please help on this. Thanks in advance.
>> --
>> Thanks and Regards,
>> Amit
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
> Regards,
> Manivannan.S
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Thanks and Regards,
Amit

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



Re: [Rails] Re: Problem with starting Rails. Please help.

2011-07-28 Thread Amit Bobade
Hi Chirag,

It worked  Thank you very very much. :)

Thanks,
-Amit.

On Thu, Jul 28, 2011 at 4:19 PM, Chirag Singhal wrote:

> mysql2 won't install on windows, use mysql gem instead.
>
> So, change this line
> gem 'mysql2', '~> 0.2.6'
> to
> gem 'mysql'
>
> and in your config/database.yml file, change the adapter from *mysql2* to
> *mysql* for all 3 databases.
>
>
> Chirag
> http://sumeruonrails.com
>
>
>
> On Thu, Jul 28, 2011 at 4:14 PM, Amit Bobade  wrote:
>
>> Hi,
>>
>> Gem file is as follows:
>>
>> source 'http://rubygems.org'
>>
>> gem 'rails', '3.0.9'
>>
>> # Bundle edge Rails instead:
>> # gem 'rails', :git => 'git://github.com/rails/rails.git'
>>
>> gem 'mysql2', '~> 0.2.6'
>>
>> # Use unicorn as the web server
>> # gem 'unicorn'
>>
>> # Deploy with Capistrano
>> # gem 'capistrano'
>>
>> # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby
>> 1.9.2+)
>> # gem 'ruby-debug'
>> # gem 'ruby-debug19', :require => 'ruby-debug'
>>
>> # Bundle the extra gems:
>> # gem 'bj'
>> # gem 'nokogiri'
>> # gem 'sqlite3-ruby', :require => 'sqlite3'
>> # gem 'aws-s3', :require => 'aws/s3'
>>
>> # Bundle gems for the local environment. Make sure to
>> # put test-only gems in this group so their generators
>> # and rake tasks are available in development mode:
>> # group :development, :test do
>> #   gem 'webrat'
>> # end
>>
>>
>>
>>
>> On Thu, Jul 28, 2011 at 4:09 PM, Chirag Singhal > > wrote:
>>
>>> looks like you have wrong entry in your Gemfile.
>>>
>>> Can you attach or paste contents of your Gemfile?
>>>
>>>
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>>
>>>
>>> On Thu, Jul 28, 2011 at 2:53 PM, Amit Bobade wrote:
>>>
 Hi Chirag,

 I am still getting error while starting the rails.
 <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
 listed in your Gemfile. <-[0m

 Please help on this, I found the gem file and added *gem 'mysql' *in to
 it but it still shows error. please help on this.

 Thanks,
 Amit


 On Wed, Jun 29, 2011 at 12:08 PM, Chirag Singhal <
 chirag.sing...@gmail.com> wrote:

> It will be in your applications root folder. Along with the files like
> README, Rakefile, etc
>
> --
> Chirag
> http://sumeruonrails.com
>
>
> On Wed, Jun 29, 2011 at 12:03 PM, Amit Bobade wrote:
>
>> Hi Chirag,
>>
>> Thanks for your great help. I have one more question. It may be a
>> silly one. You suggested that
>>
>> in your Gemfile, add:
>> gem 'mysql'
>>
>> I am not clear with the Gemfile. Please tell me where to find it.
>>
>> On Wed, Jun 29, 2011 at 11:52 AM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> Two ways:
>>> 1. You can specify that while creating your project - rails new myapp
>>> -d mysql
>>> 2. Manually modify your database.yml file to use mysql and update
>>> your Gemfile to use mysql gem
>>>
>>> sample config for database.yml, you will need similar entries for
>>> production and test databases
>>>
>>> development:
>>>   adapter: mysql
>>>   encoding: utf8
>>>   reconnect: false
>>>   database: myapp_development
>>>   pool: 5
>>>   username: root
>>>   password: password
>>>   host: localhost
>>>
>>> in your Gemfile, add:
>>>
>>> gem 'mysql'
>>>
>>>
>>> --
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>> On Wed, Jun 29, 2011 at 11:32 AM, Amit Bobade 
>>> wrote:
>>>
 Thank you very much Chirag. It worked. Could you please tell me how
 to replace SQLite with MySQL?


 On Wed, Jun 29, 2011 at 11:08 AM, Chirag Singhal <
 chirag.sing...@gmail.com> wrote:

> Make sure that you have sqlite3 installed on your machine and
> sqlite3 gem is also installed.
> If you don't have sqlite3 installed on windows, then you can grab
> sqlite3.dll from here http://www.sqlite.org/download.html and copy
> it to either your ruby bin directory or windows' system32 directory. 
> Open up
> a new console and run the server again.
>
> As an aside, I have found that RailsInstaller works pretty well for
> all this default setup on windows. You may want to try it out -
> http://railsinstaller.org/
>
>
> --
> Chirag
> http://sumeruonrails.com
>
>
> On Wed, Jun 29, 2011 at 10:57 AM, Amit Bobade <
> amit.sr...@gmail.com> wrote:
>
>> Thanks for your prompt replies. I am using Rails 3.0.9 version. I
>> used 'ruby script/rails server' command.
>> But I am getting following error pop-up while running this
>> command.
>>
>> The procedure entry point sqlite3_column_database_name could not
>> be located in the dynamic link library sqlite3.dll

Re: [Rails] Re: Problem with starting Rails. Please help.

2011-07-28 Thread Chirag Singhal
mysql2 won't install on windows, use mysql gem instead.

So, change this line
gem 'mysql2', '~> 0.2.6'
to
gem 'mysql'

and in your config/database.yml file, change the adapter from *mysql2* to *
mysql* for all 3 databases.


Chirag
http://sumeruonrails.com



On Thu, Jul 28, 2011 at 4:14 PM, Amit Bobade  wrote:

> Hi,
>
> Gem file is as follows:
>
> source 'http://rubygems.org'
>
> gem 'rails', '3.0.9'
>
> # Bundle edge Rails instead:
> # gem 'rails', :git => 'git://github.com/rails/rails.git'
>
> gem 'mysql2', '~> 0.2.6'
>
> # Use unicorn as the web server
> # gem 'unicorn'
>
> # Deploy with Capistrano
> # gem 'capistrano'
>
> # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby
> 1.9.2+)
> # gem 'ruby-debug'
> # gem 'ruby-debug19', :require => 'ruby-debug'
>
> # Bundle the extra gems:
> # gem 'bj'
> # gem 'nokogiri'
> # gem 'sqlite3-ruby', :require => 'sqlite3'
> # gem 'aws-s3', :require => 'aws/s3'
>
> # Bundle gems for the local environment. Make sure to
> # put test-only gems in this group so their generators
> # and rake tasks are available in development mode:
> # group :development, :test do
> #   gem 'webrat'
> # end
>
>
>
>
> On Thu, Jul 28, 2011 at 4:09 PM, Chirag Singhal 
> wrote:
>
>> looks like you have wrong entry in your Gemfile.
>>
>> Can you attach or paste contents of your Gemfile?
>>
>>
>> Chirag
>> http://sumeruonrails.com
>>
>>
>>
>> On Thu, Jul 28, 2011 at 2:53 PM, Amit Bobade wrote:
>>
>>> Hi Chirag,
>>>
>>> I am still getting error while starting the rails.
>>> <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
>>> listed in your Gemfile. <-[0m
>>>
>>> Please help on this, I found the gem file and added *gem 'mysql' *in to
>>> it but it still shows error. please help on this.
>>>
>>> Thanks,
>>> Amit
>>>
>>>
>>> On Wed, Jun 29, 2011 at 12:08 PM, Chirag Singhal <
>>> chirag.sing...@gmail.com> wrote:
>>>
 It will be in your applications root folder. Along with the files like
 README, Rakefile, etc

 --
 Chirag
 http://sumeruonrails.com


 On Wed, Jun 29, 2011 at 12:03 PM, Amit Bobade wrote:

> Hi Chirag,
>
> Thanks for your great help. I have one more question. It may be a silly
> one. You suggested that
>
> in your Gemfile, add:
> gem 'mysql'
>
> I am not clear with the Gemfile. Please tell me where to find it.
>
> On Wed, Jun 29, 2011 at 11:52 AM, Chirag Singhal <
> chirag.sing...@gmail.com> wrote:
>
>> Two ways:
>> 1. You can specify that while creating your project - rails new myapp
>> -d mysql
>> 2. Manually modify your database.yml file to use mysql and update your
>> Gemfile to use mysql gem
>>
>> sample config for database.yml, you will need similar entries for
>> production and test databases
>>
>> development:
>>   adapter: mysql
>>   encoding: utf8
>>   reconnect: false
>>   database: myapp_development
>>   pool: 5
>>   username: root
>>   password: password
>>   host: localhost
>>
>> in your Gemfile, add:
>>
>> gem 'mysql'
>>
>>
>> --
>> Chirag
>> http://sumeruonrails.com
>>
>> On Wed, Jun 29, 2011 at 11:32 AM, Amit Bobade 
>> wrote:
>>
>>> Thank you very much Chirag. It worked. Could you please tell me how
>>> to replace SQLite with MySQL?
>>>
>>>
>>> On Wed, Jun 29, 2011 at 11:08 AM, Chirag Singhal <
>>> chirag.sing...@gmail.com> wrote:
>>>
 Make sure that you have sqlite3 installed on your machine and
 sqlite3 gem is also installed.
 If you don't have sqlite3 installed on windows, then you can grab
 sqlite3.dll from here http://www.sqlite.org/download.html and copy
 it to either your ruby bin directory or windows' system32 directory. 
 Open up
 a new console and run the server again.

 As an aside, I have found that RailsInstaller works pretty well for
 all this default setup on windows. You may want to try it out -
 http://railsinstaller.org/


 --
 Chirag
 http://sumeruonrails.com


 On Wed, Jun 29, 2011 at 10:57 AM, Amit Bobade >>> > wrote:

> Thanks for your prompt replies. I am using Rails 3.0.9 version. I
> used 'ruby script/rails server' command.
> But I am getting following error pop-up while running this
> command.
>
> The procedure entry point sqlite3_column_database_name could not be
> located in the dynamic link library sqlite3.dll
>
> Please suggest some solution.
>
> Thanks,
> Amit
>
> On Tue, Jun 28, 2011 at 6:08 PM, Chirag Singhal <
> chirag.sing...@gmail.com> wrote:
>
>> You didn't specify which Rails version you are using.
>> Looks like you are on Rails 3, in that case, on

Re: [Rails] Re: Problem with starting Rails. Please help.

2011-07-28 Thread Amit Bobade
Hi,

Gem file is as follows:

source 'http://rubygems.org'

gem 'rails', '3.0.9'

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

gem 'mysql2', '~> 0.2.6'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

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

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



On Thu, Jul 28, 2011 at 4:09 PM, Chirag Singhal wrote:

> looks like you have wrong entry in your Gemfile.
>
> Can you attach or paste contents of your Gemfile?
>
>
> Chirag
> http://sumeruonrails.com
>
>
>
> On Thu, Jul 28, 2011 at 2:53 PM, Amit Bobade  wrote:
>
>> Hi Chirag,
>>
>> I am still getting error while starting the rails.
>> <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
>> listed in your Gemfile. <-[0m
>>
>> Please help on this, I found the gem file and added *gem 'mysql' *in to
>> it but it still shows error. please help on this.
>>
>> Thanks,
>> Amit
>>
>>
>> On Wed, Jun 29, 2011 at 12:08 PM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> It will be in your applications root folder. Along with the files like
>>> README, Rakefile, etc
>>>
>>> --
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>>
>>> On Wed, Jun 29, 2011 at 12:03 PM, Amit Bobade wrote:
>>>
 Hi Chirag,

 Thanks for your great help. I have one more question. It may be a silly
 one. You suggested that

 in your Gemfile, add:
 gem 'mysql'

 I am not clear with the Gemfile. Please tell me where to find it.

 On Wed, Jun 29, 2011 at 11:52 AM, Chirag Singhal <
 chirag.sing...@gmail.com> wrote:

> Two ways:
> 1. You can specify that while creating your project - rails new myapp
> -d mysql
> 2. Manually modify your database.yml file to use mysql and update your
> Gemfile to use mysql gem
>
> sample config for database.yml, you will need similar entries for
> production and test databases
>
> development:
>   adapter: mysql
>   encoding: utf8
>   reconnect: false
>   database: myapp_development
>   pool: 5
>   username: root
>   password: password
>   host: localhost
>
> in your Gemfile, add:
>
> gem 'mysql'
>
>
> --
> Chirag
> http://sumeruonrails.com
>
> On Wed, Jun 29, 2011 at 11:32 AM, Amit Bobade wrote:
>
>> Thank you very much Chirag. It worked. Could you please tell me how to
>> replace SQLite with MySQL?
>>
>>
>> On Wed, Jun 29, 2011 at 11:08 AM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> Make sure that you have sqlite3 installed on your machine and sqlite3
>>> gem is also installed.
>>> If you don't have sqlite3 installed on windows, then you can grab
>>> sqlite3.dll from here http://www.sqlite.org/download.html and copy
>>> it to either your ruby bin directory or windows' system32 directory. 
>>> Open up
>>> a new console and run the server again.
>>>
>>> As an aside, I have found that RailsInstaller works pretty well for
>>> all this default setup on windows. You may want to try it out -
>>> http://railsinstaller.org/
>>>
>>>
>>> --
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>>
>>> On Wed, Jun 29, 2011 at 10:57 AM, Amit Bobade 
>>> wrote:
>>>
 Thanks for your prompt replies. I am using Rails 3.0.9 version. I
 used 'ruby script/rails server' command.
 But I am getting following error pop-up while running this command.

 The procedure entry point sqlite3_column_database_name could not be
 located in the dynamic link library sqlite3.dll

 Please suggest some solution.

 Thanks,
 Amit

 On Tue, Jun 28, 2011 at 6:08 PM, Chirag Singhal <
 chirag.sing...@gmail.com> wrote:

> You didn't specify which Rails version you are using.
> Looks like you are on Rails 3, in that case, on of the following
> two should work:
> rails server (shorthand is rails s)
> or
> ruby script/rails server
>
> You may also want to read up Rails guides, which is very good if
> you are a beginner and will address these basic issues -
> http://guides.rubyonrails.org/getting_started.html
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To view this discussio

Re: [Rails] Re: Problem with starting Rails. Please help.

2011-07-28 Thread Chirag Singhal
looks like you have wrong entry in your Gemfile.

Can you attach or paste contents of your Gemfile?


Chirag
http://sumeruonrails.com



On Thu, Jul 28, 2011 at 2:53 PM, Amit Bobade  wrote:

> Hi Chirag,
>
> I am still getting error while starting the rails.
> <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
> listed in your Gemfile. <-[0m
>
> Please help on this, I found the gem file and added *gem 'mysql' *in to it
> but it still shows error. please help on this.
>
> Thanks,
> Amit
>
>
> On Wed, Jun 29, 2011 at 12:08 PM, Chirag Singhal  > wrote:
>
>> It will be in your applications root folder. Along with the files like
>> README, Rakefile, etc
>>
>> --
>> Chirag
>> http://sumeruonrails.com
>>
>>
>> On Wed, Jun 29, 2011 at 12:03 PM, Amit Bobade wrote:
>>
>>> Hi Chirag,
>>>
>>> Thanks for your great help. I have one more question. It may be a silly
>>> one. You suggested that
>>>
>>> in your Gemfile, add:
>>> gem 'mysql'
>>>
>>> I am not clear with the Gemfile. Please tell me where to find it.
>>>
>>> On Wed, Jun 29, 2011 at 11:52 AM, Chirag Singhal <
>>> chirag.sing...@gmail.com> wrote:
>>>
 Two ways:
 1. You can specify that while creating your project - rails new myapp -d
 mysql
 2. Manually modify your database.yml file to use mysql and update your
 Gemfile to use mysql gem

 sample config for database.yml, you will need similar entries for
 production and test databases

 development:
   adapter: mysql
   encoding: utf8
   reconnect: false
   database: myapp_development
   pool: 5
   username: root
   password: password
   host: localhost

 in your Gemfile, add:

 gem 'mysql'


 --
 Chirag
 http://sumeruonrails.com

 On Wed, Jun 29, 2011 at 11:32 AM, Amit Bobade wrote:

> Thank you very much Chirag. It worked. Could you please tell me how to
> replace SQLite with MySQL?
>
>
> On Wed, Jun 29, 2011 at 11:08 AM, Chirag Singhal <
> chirag.sing...@gmail.com> wrote:
>
>> Make sure that you have sqlite3 installed on your machine and sqlite3
>> gem is also installed.
>> If you don't have sqlite3 installed on windows, then you can grab
>> sqlite3.dll from here http://www.sqlite.org/download.html and copy it
>> to either your ruby bin directory or windows' system32 directory. Open 
>> up a
>> new console and run the server again.
>>
>> As an aside, I have found that RailsInstaller works pretty well for
>> all this default setup on windows. You may want to try it out -
>> http://railsinstaller.org/
>>
>>
>> --
>> Chirag
>> http://sumeruonrails.com
>>
>>
>> On Wed, Jun 29, 2011 at 10:57 AM, Amit Bobade 
>> wrote:
>>
>>> Thanks for your prompt replies. I am using Rails 3.0.9 version. I
>>> used 'ruby script/rails server' command.
>>> But I am getting following error pop-up while running this command.
>>>
>>> The procedure entry point sqlite3_column_database_name could not be
>>> located in the dynamic link library sqlite3.dll
>>>
>>> Please suggest some solution.
>>>
>>> Thanks,
>>> Amit
>>>
>>> On Tue, Jun 28, 2011 at 6:08 PM, Chirag Singhal <
>>> chirag.sing...@gmail.com> wrote:
>>>
 You didn't specify which Rails version you are using.
 Looks like you are on Rails 3, in that case, on of the following two
 should work:
 rails server (shorthand is rails s)
 or
 ruby script/rails server

 You may also want to read up Rails guides, which is very good if you
 are a beginner and will address these basic issues -
 http://guides.rubyonrails.org/getting_started.html

 --
 You received this message because you are subscribed to the Google
 Groups "Ruby on Rails: Talk" group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/rubyonrails-talk/-/uKCg5GXX4o8J.

 To post to this group, send email to
 rubyonrails-talk@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

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

[Rails] Re: different code for each record, how to implement??

2011-07-28 Thread aupayo
Thank you all so much. I did it like you said, with a set of models
not based on ActiveRecord.

Best regards,

Cristóbal


On Jul 13, 5:01 am, Conrad Taylor  wrote:
> On Tue, Jul 12, 2011 at 9:46 AM, Ramon Leon wrote:
>
>
>
>
>
>
>
>
>
> > On 07/12/2011 08:42 AM, Conrad Taylor wrote:
>
> >> The above class can be refactored as to the following:
>
> >> class SiteFactory
> >>   def self.create( site )
> >>     site.new
> >>   end
> >> end
>
> > I'm just curious, what exactly is the point of this class?
>
> >  Now, we can rewrite our calling routine to the following:
>
> >> [ HerSite, HisSite ].each do | klass |
> >>   site = SiteFactory.create( klass )
> >>   Spider.crawl_site( site )
> >> end
>
> > Seems needlessly verbose, why not just get rid of the factory that isn't
> > doing anything and just do...
>
> >    [ HerSite, HisSite ].each do | klass |
> >       Spider.crawl_site(klass.new)
> >    end
>
> > In fact, why not just...
>
> >    Site.subclasses.each { | klass | Spider.crawl_site(klass.new) }
>
> Yes, the above is possible but I can see where just getting all the
> subclasses of an
> class might night be what you want.
>
> > Forgive me, I'm a Smalltalker, but this whole explicit factory business and
> > explicit arrays of classes just looks too Java'ish in an object system with
> > meta classes and reflection.  Is there some reason you wouldn't just reflect
> > the subclasses?  Is there some reason for a factory that does nothing?  Even
> > if you need a factory, why wouldn't you just use class methods on Site?
>
> Next, the Ruby language 1.9.2/1.9.3dev doesn't support a built in method
> called subclasses like Smalltalk.  Thus, one could implement a subclasses
> method in the Ruby language as follows:
>
> class Class
>   def subclasses
>     ObjectSpace.each_object(Class).select { |klass| klass < self }  # select
> all the methods that are derived from self (i.e. Site).
>   end
> end
>
> This requires opening a class called Class and defining a method called
> subclasses.  Furthermore, one can use a built in Ruby hook method call
> inherited to arrive at the same result.  For example,
>
> class Site
>
>   @subclasses = []
>
>   class << self
>     attr_reader :subclasses
>   end
>
>   def self.inherited( klass )
>     @subclasses << klass
>   end
>
>   def to_s
>     puts "using #{self.class}#to_s"
>   end
>
>   def crawl
>     puts "using #{self.class}#crawl version 0"
>   end
>
> end
>
> Ramon, you're correct in saying that SiteFactory class could be remove for a
> much more concise solution.
>
> -Conrad
>
>
>
>
>
>
>
>
>
> > --
> > Ramon Leon
> >http://onsmalltalk.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to 
> > rubyonrails-talk@googlegroups.**com
> > .
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@**googlegroups.com > i...@googlegroups.com>
> > .
> > For more options, visit this group athttp://groups.google.com/**
> > group/rubyonrails-talk?hl=en
> > .

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



[Rails] starter question about paperclip / relations in rails 3

2011-07-28 Thread Daniel Amsterdam
Hello,

i'm trying out Rails 3 and i've created a little app with paperclip.
My problem is that i cant get the assets for a user in the index
action but in the edit action it works. i have the flowing set up

class User
 has_many :assets

class Asset
   belongs_to :user
   has_attached_file :asset,
:styles => { :medium => "300x300>",
 :thumb => "100x100>" }

--

In my edit action i can get the assets for the user easy by doing:

<% f.fields_for :assets do |asset_fields| %>

<% unless asset_fields.object.new_record? %>


<%= link_to 
image_tag(asset_fields.object.asset.url(:thumb)),
asset_fields.object.asset.url(:original) %>
<%= f.label :destroy, 'Verwijder' %>
<%= asset_fields.check_box(:_destroy) 
%>

<% end %>
<% end %>

Now in my index action i want to display the user.assets also but i
get the error undefined method `url' for xx

in the user controler i get the users by
@users = User.all(:include => :assets)
#@users = User.all()

in the view i have
<% @users.each do |user| %>

<%= user.firstname %><%= user.lastname %>
<%= debug(user) %>
<% unless current_user.nil? %>
<% if current_user.id == user.id %>
<%= link_to "Edit", 
edit_user_path(user) %>
<% end %>
<% end %>
<%= debug(user.assets) %>
<% user.assets.each do |assetfield| %>
<%= assetfield.url(:thumb) %>
<% end %>


<% end %>

and i get the error undefined method `url' for # so the asset object is not there i gues. I'm having
trouble to understand whats wrong because the realtion is fine. I hop
somebody here can help me understand this and help me out?

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



Re: [Rails] Error while starting Rails. Please help.

2011-07-28 Thread Manivannan Sivaprakasam
Hi amit,
  Please tell me the gem you gave for mysql in Gemfile. (any
versions?)

On Thu, Jul 28, 2011 at 2:48 PM, Amit Bobade  wrote:

> *Dear all:*
>
> I am trying to start rails but it is not getting started. It is giving
> following error:
>
> <-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
> listed in your Gemfile. <-[0m
>
> I used following commands for app:
>
> *rails new myapp -d mysql
>
> *after successfully executing this command  I run command* *to* *start
> rails.
> *
> ruby* *script/rails server *
>
> but it is showing error: *<-[31mCould not find gem 'mysql112 (~> 0.2.6)'
> in any of the gem sources listed in your Gemfile. <-[0m*
>
> Please help on this. Thanks in advance.
> --
> Thanks and Regards,
> Amit
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Regards,
Manivannan.S

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



[Rails] Re: Getting error while using paperclip gem..

2011-07-28 Thread Chirag Shah
Please mentioned more details that what you trying to do with the paper 
clip gem
By this error, only things come that you have not show.erb in your views
Or you have to specify any render or redirect in the show method


- Chirag Shah

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

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



[Rails] Getting error while using paperclip gem..

2011-07-28 Thread Dhaval Mehta
I m getting error while using paperclip gem:

Template is missing

Missing template uploads/show with
{:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], 
:locale=>[:en, :en]}
in view paths "C:/Users/trainee5/uploaders/app/views"


can any one help me..


Thanks..

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



Re: [Rails] Re: Problem with starting Rails. Please help.

2011-07-28 Thread Amit Bobade
Hi Chirag,

I am still getting error while starting the rails.
<-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
listed in your Gemfile. <-[0m

Please help on this, I found the gem file and added *gem 'mysql' *in to it
but it still shows error. please help on this.

Thanks,
Amit

On Wed, Jun 29, 2011 at 12:08 PM, Chirag Singhal
wrote:

> It will be in your applications root folder. Along with the files like
> README, Rakefile, etc
>
> --
> Chirag
> http://sumeruonrails.com
>
>
> On Wed, Jun 29, 2011 at 12:03 PM, Amit Bobade wrote:
>
>> Hi Chirag,
>>
>> Thanks for your great help. I have one more question. It may be a silly
>> one. You suggested that
>>
>> in your Gemfile, add:
>> gem 'mysql'
>>
>> I am not clear with the Gemfile. Please tell me where to find it.
>>
>> On Wed, Jun 29, 2011 at 11:52 AM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> Two ways:
>>> 1. You can specify that while creating your project - rails new myapp -d
>>> mysql
>>> 2. Manually modify your database.yml file to use mysql and update your
>>> Gemfile to use mysql gem
>>>
>>> sample config for database.yml, you will need similar entries for
>>> production and test databases
>>>
>>> development:
>>>   adapter: mysql
>>>   encoding: utf8
>>>   reconnect: false
>>>   database: myapp_development
>>>   pool: 5
>>>   username: root
>>>   password: password
>>>   host: localhost
>>>
>>> in your Gemfile, add:
>>>
>>> gem 'mysql'
>>>
>>>
>>> --
>>> Chirag
>>> http://sumeruonrails.com
>>>
>>> On Wed, Jun 29, 2011 at 11:32 AM, Amit Bobade wrote:
>>>
 Thank you very much Chirag. It worked. Could you please tell me how to
 replace SQLite with MySQL?


 On Wed, Jun 29, 2011 at 11:08 AM, Chirag Singhal <
 chirag.sing...@gmail.com> wrote:

> Make sure that you have sqlite3 installed on your machine and sqlite3
> gem is also installed.
> If you don't have sqlite3 installed on windows, then you can grab
> sqlite3.dll from here http://www.sqlite.org/download.html and copy it
> to either your ruby bin directory or windows' system32 directory. Open up 
> a
> new console and run the server again.
>
> As an aside, I have found that RailsInstaller works pretty well for all
> this default setup on windows. You may want to try it out -
> http://railsinstaller.org/
>
>
> --
> Chirag
> http://sumeruonrails.com
>
>
> On Wed, Jun 29, 2011 at 10:57 AM, Amit Bobade wrote:
>
>> Thanks for your prompt replies. I am using Rails 3.0.9 version. I used
>> 'ruby script/rails server' command.
>> But I am getting following error pop-up while running this command.
>>
>> The procedure entry point sqlite3_column_database_name could not be
>> located in the dynamic link library sqlite3.dll
>>
>> Please suggest some solution.
>>
>> Thanks,
>> Amit
>>
>> On Tue, Jun 28, 2011 at 6:08 PM, Chirag Singhal <
>> chirag.sing...@gmail.com> wrote:
>>
>>> You didn't specify which Rails version you are using.
>>> Looks like you are on Rails 3, in that case, on of the following two
>>> should work:
>>> rails server (shorthand is rails s)
>>> or
>>> ruby script/rails server
>>>
>>> You may also want to read up Rails guides, which is very good if you
>>> are a beginner and will address these basic issues -
>>> http://guides.rubyonrails.org/getting_started.html
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ruby on Rails: Talk" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/rubyonrails-talk/-/uKCg5GXX4o8J.
>>>
>>> To post to this group, send email to
>>> rubyonrails-talk@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-talk+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>
>>
>>
>> --
>> Thanks and Regards,
>> Amit
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Ruby on Rails: Talk" group.
>> To post to this group, send email to
>> rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com
> .
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails

[Rails] Error while starting Rails. Please help.

2011-07-28 Thread Amit Bobade
*Dear all:*

I am trying to start rails but it is not getting started. It is giving
following error:

<-[31mCould not find gem 'mysql112 (~> 0.2.6)' in any of the gem sources
listed in your Gemfile. <-[0m

I used following commands for app:

*rails new myapp -d mysql

*after successfully executing this command  I run command* *to* *start
rails.
*
ruby* *script/rails server *

but it is showing error: *<-[31mCould not find gem 'mysql112 (~> 0.2.6)' in
any of the gem sources listed in your Gemfile. <-[0m*

Please help on this. Thanks in advance.
-- 
Thanks and Regards,
Amit

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



Re: [Rails] Question regarding associations..

2011-07-28 Thread Colin Law
On 28 July 2011 07:53, Rick & Nellie Flower  wrote:
> Ok.. So I've got my initial table structures setup and I was hoping I could 
> have associations help me out with something akin to embedded/nested objects 
> but without the direct nesting (unless there's another way to achieve that 
> goal)..
>
> So, I've got an Address class that looks like the following :
>
> class CreateAddresses < ActiveRecord::Migration
>  belongs_to :user

The belongs_to definition should be in the model class not the migration.

>
>  def self.up
>    create_table :addresses do |t|
>      t.string :address
>      t.string :city
>      t.string :state
>      t.string :zip
>      t.string :email
>      t.string :phone
>
>      t.timestamps
>    end
>  end
>
>  def self.down
>    drop_table :addresses
>  end
> end
> 
> I've then got a user class that looks like the following :
>
> class CreateUsers < ActiveRecord::Migration
>  has_one :address

Ditto for has_one

Colin

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



[Rails] Re: it doesn't work jquery

2011-07-28 Thread Kleber Shimabuku
Hi,

Show us the error you are getting on that.

Also, check your html code generated to see if the javascript
libraries are loading correctly, in this case, the jquery library.

If you are not on rails 3.1 you are probably loading the prototype
files instead the jquery as needed.



On Jul 28, 3:31 pm, 原田伸也  wrote:
> Hi all! I want to add alert message via jquery when User clicks  id="star">star.
> But, It can't work.
> Please teach me some advice.
>
> Thanks!
>
> # posts/index.html.erb
>
> [code]
> ...
> <% @posts.each do |post| %>
>   
> <%= post.id %>
> <%= post.content %>
> 
> 
>   like
> 
> star
> <%= post.created_at.strftime("%Y年%m月%d日%H:%M:%S") %>
> <% end %>
> 
> 
>
> 
> [/code]
>
> # application.js
> [code]
> $(document).ready(function() {
>$("#star").click(function(){
>  alert("add_star");
>})
>  });
> [/code]

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



Re: [Rails] rails 3 routing error

2011-07-28 Thread Colin Law
On 28 July 2011 04:28, 7stud --  wrote:
>  [...]
>  resources :sessions, :only => [:new, :create, :destory]

Nothing to do with the problem, but that should be destroy, not destory

Colin

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



Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
You don't have a FK for user_id in your ADDRESSES table for starters, and
you didn't include your model files, so there's no way of knowing whether
you've defined the relationships there.

See:
http://guides.rubyonrails.org/migrations.html
http://guides.rubyonrails.org/association_basics.html

On Thu, Jul 28, 2011 at 8:53 AM, Rick & Nellie Flower wrote:

> Ok.. So I've got my initial table structures setup and I was hoping I could
> have associations help me out with something akin to embedded/nested objects
> but without the direct nesting (unless there's another way to achieve that
> goal)..
>
> So, I've got an Address class that looks like the following :
>
> class CreateAddresses < ActiveRecord::Migration
>  belongs_to :user
>
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :addresses
>  end
> end
> 
> I've then got a user class that looks like the following :
>
> class CreateUsers < ActiveRecord::Migration
>  has_one :address
>
>  def self.up
>create_table :users do |t|
>  t.srting  :name
>  t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :users
>  end
> end
>
> I was hoping I could do something like the following in the rails console
> and have it work
> but it does not:
>
> => @user=User.create
> =>@city=@user.address.city
>
> Any ideas on whether I'm barking up the wrong tree with associations --
> perhaps using
> the wrong syntax or is it even possible with what I want to do?  I feel
> like they ought to work
> but…
>
> Any ideas?? Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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