Re: [Rails] Rails Join 2 table

2011-08-09 Thread Sayuj Othayoth
On Tue, Aug 9, 2011 at 11:08 AM, Sayuj Othayoth sayujothay...@gmail.comwrote:



 On Mon, Aug 8, 2011 at 5:54 PM, Colin Law clan...@googlemail.com wrote:

 On 8 August 2011 12:34, Sayuj Othayoth sayujothay...@gmail.com wrote:
 
 
  On Mon, Aug 8, 2011 at 4:42 PM, Colin Law clan...@googlemail.com
 wrote:
 
  On 8 August 2011 11:40, Sayuj Othayoth sayujothay...@gmail.com
 wrote:
  
  
   On Mon, Aug 8, 2011 at 4:06 PM, Colin Law clan...@googlemail.com
   wrote:
  
   On 8 August 2011 11:17, Sayuj Othayoth sayujothay...@gmail.com
 wrote:
[...]
class StatusMessage  ActiveRecord::Base
  belongs_to :users
  
   That should be :user, singular.
 
  Did you make this correction as I suggested previously, so it should
  be belongs_to :user (each message belongs to one user so singular)
 
  Colin
 
 
  Yes I made the changes.
  Error is undefined method `user' for #StatusMessage:0xb126384

 Could you post the code for the StatusMessage class again please?

 class StatusMessage  ActiveRecord::Base
   belongs_to :users
   default_scope :order = created_at DESC
 end



I should use *belongs_to :user *instead of *belongs_to :users*

Thank you Colin.


 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.





-- 
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] wrong number of arguments (2 for 0..1)

2011-08-09 Thread Kurtis Rainbolt-Greene
Try this:

https://gist.github.com/1133491


On Mon, Aug 8, 2011 at 10:36 PM, praveen k. li...@ruby-forum.com wrote:
 Hi,
 please can anyone help me with this codewhen i am executing the
 following code, i am getting the error.

 code:
 @animals=Bird.find(:all,:conditions =['state like?', '%' +
 params[:number]+'%'])
        @ani=@animals.find(:all,:conditions =['city like?', '%bad%'])

 error:
 wrong number of arguments (2 for 0..1)

 please can anyone help me out.
 Thanks.

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

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





-- 
Kurtis Rainbolt-Greene:
 - Hacker, Designer, Author
 - 3725 Onyx Street, Eugene, OR 97405
 - (202) 643-2263

-- 
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: weird problem when updating to RC5

2011-08-09 Thread ryanjmclaughlin
same issue here...

On Aug 8, 8:52 pm, Tomas R. li...@ruby-forum.com wrote:
 i updated from RC4 to RC5 (3.1) and everytime I do
 SomeModel.all, .first, anything I get something like this

 ActionView::Template::Error (undefined method `visitor' for
 #ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x0003c9a1f0):

 PostgreSQLAdapter or SQLiteAdapter

 --
 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: Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-09 Thread Prakash Murthy
Interesting. It would be nice if one of the representatives from the team 
present about the project at the next RubyConfIndia.

Thanks,
Prakash Murthy
http://twitter.com/_prakash

-- 
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/-/SM-Linb-ZP8J.
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] newbie needs help with associations

2011-08-09 Thread Stan McFarland
Hi,

Newbie here.  I'm having to enter this from memory since my work is on
a closed network, so forgive any syntax errors.

I'm trying to recreate some basic Google Plus functionality with
regards to users, posts, and circles - that is, a user can see a post
only if he/she is in one or more of the same circles that the post
belongs to:

class User
  has_and_belongs_to  :circles
  has_many :posts
class Post
  has_and_belongs_to :circles
  belongs_to :user   # the user that created the post
class Circle
  has_and_belongs_to :posts
  has_and_belongs_to :users

Given the above, how can I retrieve all posts viewable by a user?
The SQL (I think) would be:

select distinct p.id
  from posts p, circles_posts cp, circles_users cu
  where p.id = circles_posts.post_id
  and cp.circle_id = cu.circle_id
  and cu.user_id = current_user.id

I also need to be able to retrieve posts related to a subset of
circles to which the user belongs:

select distinct p.id
  from posts p, circles_posts cp, circles_users cu
  where p.id = circles_posts.post_id
  and cp.circle_id = cu.circle_id
  and cu.circle_id in (4,5,6)
  and cu.user_id = current_user.id


Can someone help?I can handle the basic RoR associations but this
one is making my brain explode.  :)


Thanks _very_ much,

Stan McFarland

-- 
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] Sqlite 3 install error on Heroku, Rails 3.1

2011-08-09 Thread Karthikeyan
Hello Rails people.

I tried to push a Rails 3.1 app ( created using cedar stack) to Heroku
and I encountered the following error

Installing sqlite3 (1.3.4) with native extensions Unfortunately, a
fatal error has occurred. Please report this error to the Bundler
issue tracker at https://github.com/carlhuda/bundler/issues so that we
can fix it. Thanks!
   /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue
in block in build_extensions': ERROR: Failed to build gem native
extension. (Gem::Installer::ExtensionBuildError)
   /usr/local/bin/ruby extconf.rb
   checking for sqlite3.h... no
   sqlite3.h is missing. Try 'port install sqlite3 +universal'
   or 'yum install sqlite3-devel' and check your shared library
search path (the
   location where your sqlite3 shared library is located).
   *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of
   necessary libraries and/or headers.  Check the mkmf.log file
for more
   details.  You may need configuration options.
   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/usr/local/bin/ruby
   --with-sqlite3-dir
   --without-sqlite3-dir
   --with-sqlite3-include
   --without-sqlite3-include=${sqlite3-dir}/include
   --with-sqlite3-lib
   --without-sqlite3-lib=${sqlite3-dir}/lib
   --enable-local
   --disable-local
   Gem files will remain installed in /tmp/build_z66vpx0uo7v1/
vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.4 for inspection.

the message indicates something serious is going on. Can it be fixed?

-- 
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: wrong number of arguments (2 for 0..1)

2011-08-09 Thread praveen k.
Kurtis Rainbolt-greene wrote in post #1015633:
 Try this:

 https://gist.github.com/1133491


 On Mon, Aug 8, 2011 at 10:36 PM, praveen k. li...@ruby-forum.com
 wrote:
 wrong number of arguments (2 for 0..1)
 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.





 --
 Kurtis Rainbolt-Greene:
 - Hacker, Designer, Author
 - 3725 Onyx Street, Eugene, OR 97405
 - (202) 643-2263

thankyou Kurtis Rainbolt-Greene. ya i tried it but even it is giving me
an error.
error:
undefined method `condition' for Bird(id: integer, state: string, city:
string):Class
Thankyou

-- 
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] Rails Join 2 table

2011-08-09 Thread Colin Law
On 9 August 2011 07:00, Sayuj Othayoth sayujothay...@gmail.com wrote:


 On Tue, Aug 9, 2011 at 11:08 AM, Sayuj Othayoth sayujothay...@gmail.com
 wrote:


 On Mon, Aug 8, 2011 at 5:54 PM, Colin Law clan...@googlemail.com wrote:

 On 8 August 2011 12:34, Sayuj Othayoth sayujothay...@gmail.com wrote:
 
 
  On Mon, Aug 8, 2011 at 4:42 PM, Colin Law clan...@googlemail.com
  wrote:
 
  On 8 August 2011 11:40, Sayuj Othayoth sayujothay...@gmail.com
  wrote:
  
  
   On Mon, Aug 8, 2011 at 4:06 PM, Colin Law clan...@googlemail.com
   wrote:
  
   On 8 August 2011 11:17, Sayuj Othayoth sayujothay...@gmail.com
   wrote:
[...]
class StatusMessage  ActiveRecord::Base
  belongs_to :users
  
   That should be :user, singular.
 
  Did you make this correction as I suggested previously, so it should
  be belongs_to :user (each message belongs to one user so singular)
 
  Colin
 
 
  Yes I made the changes.
  Error is undefined method `user' for #StatusMessage:0xb126384

 Could you post the code for the StatusMessage class again please?

 class StatusMessage  ActiveRecord::Base
   belongs_to :users
   default_scope :order = created_at DESC
 end


 I should use belongs_to :user instead of belongs_to :users

In my initial post I pointed out two errors.  That was one of them.
Then later I queried whether you had made that correction and you said
you had.

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] newbie needs help with associations

2011-08-09 Thread Colin Law
On 8 August 2011 21:44, Stan McFarland stan.mcfarl...@blackoakweb.com wrote:
 Hi,

 Newbie here.  I'm having to enter this from memory since my work is on
 a closed network, so forgive any syntax errors.

 I'm trying to recreate some basic Google Plus functionality with
 regards to users, posts, and circles - that is, a user can see a post
 only if he/she is in one or more of the same circles that the post
 belongs to:

 class User
  has_and_belongs_to  :circles
  has_many :posts
 class Post
  has_and_belongs_to :circles
  belongs_to :user   # the user that created the post
 class Circle
  has_and_belongs_to :posts
  has_and_belongs_to :users

Firstly each of those should be has_and_belongs_to_many, but I expect
you knew that.
Secondly, I don't know whether you realise, but I don't think the
above will fully model the google+ concept.  I think you need to model
the asymmetric way that circles relate to users.  I think you will
need two relationships, firstly user has_many circles and circle
belongs to user.  This will map the fact that a user has a number of
circles.  Then you need to record who is *in* that circle via a
has_and_belongs_to_many relationships, where you will need to use the
:class_name specifier.  Something like
user has_and_belongs_to_many :member_of_circles, :class_name='Circle'
Then the circles owned by a user are
@user.circles
and the circles that the user is in are
@user.member_of_circles
You will also need the equivalent reverse relationship to get all the
users that are members of a circle.

I have not tested that, in fact I am not sure I have used :class_name
with a has_and_belongs_to relationship, I tend to prefer explicit join
tables.

If you are a beginner at Rails I think you might be better to start
with something simpler, this is a non-trivial problem for the
beginner.  Have you worked through some good tutorials?  I recommend
railstutorial.org which is free to use online.  Make sure you are
using Rails 3 and that the tutorial is for Rails 3.

Also work through the Rails Guides.

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] wrong number of arguments (2 for 0..1)

2011-08-09 Thread Colin Law
On 9 August 2011 06:36, praveen k. li...@ruby-forum.com wrote:
 Hi,
 please can anyone help me with this codewhen i am executing the
 following code, i am getting the error.

 code:
 @animals=Bird.find(:all,:conditions =['state like?', '%' +
 params[:number]+'%'])
        @ani=@animals.find(:all,:conditions =['city like?', '%bad%'])

 error:
 wrong number of arguments (2 for 0..1)

Is it as simple as the fact that you have not got a space before the
?, so that rails does not recognise it as a value to be filled in?

Otherwise which line is generating the error?

Note that if you use the rails console you can type statements
directly into the console to see whether they work which can help to
diagnose which bit of a statement is giving problems.  params will not
be available of course but you can try it with fixed text to check it
works.

However you do it a useful approach is to simplify the failing
statement right down to something that works, then build it up to what
you really want and then you will find the detail that is causing the
problem.  As I said you can do most of this in the rails console.

Colin

Colin


 please can anyone help me out.
 Thanks.

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

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-talk@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+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: Problem upgrading to Rails 3.1 using capistrano.

2011-08-09 Thread sreid
Seems to have been fixed overnight by new bundler version 1.0.17 : see
https://github.com/carlhuda/bundler/issues/1342

On Aug 8, 11:24 pm, sreid sa...@broadgairhill.com wrote:
 I've upgraded a Rails 3.0 app to Rails 3.1. It's working fine on my
 development Windows PC using Webrick / ruby 1.8.7.

 I tried to deploy using Capistrano to a server using Passenger/nginx/
 REE, but am getting this error :

   * executing cd /home/.../releases/20110808200618  bundle install
 --gemfile /home/.../releases/20110808200618/Gemfile --path /home/.../
 shared/bundle --quiet --without development test resque_development
 resque_scheduler_development
     servers: [...]
     [...] executing command
  ** [out :: ...] /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/version.rb:202:in `bump': undefined method `succ' for
 nil:NilClass (NoMethodError)
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:17
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:134:in `call'
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:134:in `satisfied_by?'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/source.rb:231:in `all?'
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:134:in `each'
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:134:in `all?'
  ** [out :: ...] from /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/
 rubygems/requirement.rb:134:in `satisfied_by?'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/rubygems_ext.rb:138:in `matches_spec?'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/index.rb:47:in `search_for_all_platforms'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/index.rb:47:in `select'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/index.rb:47:in `search_for_all_platforms'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:357:in `search'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:346:in `gems_size'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:179:in `resolve'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/source.rb:231:in `sort_by'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:175:in `each'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:175:in `sort_by'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:175:in `resolve'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:160:in `start'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:128:in `resolve'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:127:in `catch'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/resolver.rb:127:in `resolve'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/definition.rb:151:in `resolve'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/definition.rb:90:in `specs'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/definition.rb:85:in `resolve_remotely!'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/installer.rb:43:in `run'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/installer.rb:8:in `install'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/cli.rb:220:in `install'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/vendor/thor/task.rb:22:in `send'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/vendor/thor/task.rb:22:in `run'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/vendor/thor/invocation.rb:118:in `invoke_task'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/vendor/thor.rb:263:in `dispatch'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/lib/
 bundler/vendor/thor/base.rb:386:in `start'
  ** [out :: ...] from /home/.../rails3/gems/gems/bundler-1.0.16/bin/
 bundle:13
  ** [out :: ...] from /home/.../rails3/bin/bundle:19:in `load'
  ** [out :: ...] from /home/.../rails3/bin/bundle:19

 Any pointers ?

-- 
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 

[Rails] Re: Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-09 Thread Nithin
@prakash: The project has already been presented once at Rubyconf India (in 
2010 http://rubyconfindia.org/2010/speakers.html). But it would be 
interesting to hear from the team about how the project has grown since 
then. Back then it was a very new project and now it has grown to become a 
project implemented across 13k schools. 

-- 
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/-/V2i5W3TR67cJ.
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: Ruby on Rails ebook

2011-08-09 Thread Sushil Gupta
I basically understand and have done a little with php/mysql but don't know 
anything about MVC or Ruby or CoC like that. Can you suggest me any good 
free ebook that would be suitable for beginners like me?

-- 
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/-/odXzuDS6vgwJ.
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 can I update a div value using Ajax but calling a function on the OnChange?

2011-08-09 Thread Kleber Shimabuku
Hey guys,

I'm trying to update a div with a result coming from a request to the
database.

So I have created this method on the controller

  def retrieve_part_price
@price = Part.find(params[:id])
respond_to do |format|
  format.html { redirect_to(items_path)}
  format.js { render :nothing = true }
end
  end

and added it to the routes properly, but I don't know how should I
call it from my view side to bring the value using Ajax.

any advice? blog post?


Thank you.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-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: Invoking browser from Ruby script with URL argument: How?

2011-08-09 Thread Frederick Cheung


On Aug 9, 1:25 am, Jarin Udom jarin.u...@gmail.com wrote:
 On a Mac, you don't need launchy, just do:

 openhttp://example.com/whatever

You don't need launchy on any platform but it takes away from you the
hassle of deciding which strategy to use for a given environment.

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] ActiveScaffold - custom show action

2011-08-09 Thread Michal F.
Hi all,
I've added custom show action (as an action link - I want to use default
one too). Everything renders well, but I'm missing a Close ([x])
button. So, I copied AS' default _show.rhtml template and edited it a
bit (just added custom output and removed label). However, when I click
at Close I get error output:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.theme

div id=%= active_scaffold_id -% class=active-scaffold
active-scaffold-%= controller_id % %= active_scaffold_config.theme
%-theme

Why is active_scaffold_config nil?

Thank you for any help.

-- 
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] Re: Ruby on Rails ebook

2011-08-09 Thread tudor cornea
On Tue, Aug 9, 2011 at 10:16 AM, Sushil Gupta desus...@gmail.com wrote:

 I basically understand and have done a little with php/mysql but don't know
 anything about MVC or Ruby or CoC like that. Can you suggest me any good
 free ebook that would be suitable for beginners like me?

 --
 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/-/odXzuDS6vgwJ.
 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.


I have found this book to be useful when I started learning.
It teaches you different important concepts like authentication, test driven
development (rspec), which you
will use in your everyday apps:
   http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

You can also check out the tutorials here:
   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 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] Nesting select and text_field in radio_button

2011-08-09 Thread Jarek Plonski
I'm creating my first Rails app and need an idea creating forms.

I have Meeting model with place attribute.

I want to have two fields for Meeting.place = one would be select with
places from other meetings or text_field if the place is being used
first time. User would be selecting radio_button of which field he has
used.

So is there any way to nest select and text_field within 2
radio_buttons?

I would appreciate any other solution ideas too.
Cheers

-- 
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] newbie needs help with associations

2011-08-09 Thread Stan@home
Thanks for the feedback.  You're right about the asymmetry of the circles- I'll 
work on that.   I'd pick a simpler problem to solve but this is what my client 
is paying me for. I've actually built a few rails projects but they were really 
straightforward. 

Thanks again

Sent from my iPhone

On Aug 9, 2011, at 3:50 AM, Colin Law clan...@googlemail.com wrote:

 On 8 August 2011 21:44, Stan McFarland stan.mcfarl...@blackoakweb.com wrote:
 Hi,
 
 Newbie here.  I'm having to enter this from memory since my work is on
 a closed network, so forgive any syntax errors.
 
 I'm trying to recreate some basic Google Plus functionality with
 regards to users, posts, and circles - that is, a user can see a post
 only if he/she is in one or more of the same circles that the post
 belongs to:
 
 class User
  has_and_belongs_to  :circles
  has_many :posts
 class Post
  has_and_belongs_to :circles
  belongs_to :user   # the user that created the post
 class Circle
  has_and_belongs_to :posts
  has_and_belongs_to :users
 
 Firstly each of those should be has_and_belongs_to_many, but I expect
 you knew that.
 Secondly, I don't know whether you realise, but I don't think the
 above will fully model the google+ concept.  I think you need to model
 the asymmetric way that circles relate to users.  I think you will
 need two relationships, firstly user has_many circles and circle
 belongs to user.  This will map the fact that a user has a number of
 circles.  Then you need to record who is *in* that circle via a
 has_and_belongs_to_many relationships, where you will need to use the
 :class_name specifier.  Something like
 user has_and_belongs_to_many :member_of_circles, :class_name='Circle'
 Then the circles owned by a user are
 @user.circles
 and the circles that the user is in are
 @user.member_of_circles
 You will also need the equivalent reverse relationship to get all the
 users that are members of a circle.
 
 I have not tested that, in fact I am not sure I have used :class_name
 with a has_and_belongs_to relationship, I tend to prefer explicit join
 tables.
 
 If you are a beginner at Rails I think you might be better to start
 with something simpler, this is a non-trivial problem for the
 beginner.  Have you worked through some good tutorials?  I recommend
 railstutorial.org which is free to use online.  Make sure you are
 using Rails 3 and that the tutorial is for Rails 3.
 
 Also work through the Rails Guides.
 
 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.
 

-- 
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: will_paginate appending escape=false to every page URL?

2011-08-09 Thread Mislav
That might be a bug with older versions. For Rails 3, use will_paginate 
3.0.pre4 or later:

  gem will_paginate, ~ 3.0.pre4

-- 
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/-/Oq9kvtMqx38J.
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: Sqlite 3 install error on Heroku, Rails 3.1

2011-08-09 Thread Luis Lavena
On Aug 9, 3:29 am, Karthikeyan mindas...@gmail.com wrote:
 Hello Rails people.

 I tried to push a Rails 3.1 app ( created using cedar stack) to Heroku
 and I encountered the following error

 Installing sqlite3 (1.3.4) with native extensions Unfortunately, a
 fatal error has occurred. Please report this error to the Bundler
 issue tracker athttps://github.com/carlhuda/bundler/issuesso that we
 can fix it. Thanks!

SQLite3 is not available as database on Heroku.

Only database available is PostgreSQL:

http://devcenter.heroku.com/articles/database

You need to modify your Gemfile to limit sqlite3 to development/test
environment and add 'pg' gem for production one.

--
Luis Lavena

-- 
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] Nesting select and text_field in radio_button

2011-08-09 Thread Hassan Schroeder
On Tue, Aug 9, 2011 at 5:49 AM, Jarek Plonski li...@ruby-forum.com wrote:

 I want to have two fields for Meeting.place = one would be select with
 places from other meetings or text_field if the place is being used
 first time. User would be selecting radio_button of which field he has
 used.

 So is there any way to nest select and text_field within 2
 radio_buttons?

Why bother with the radio buttons?

If there's something in the text field use it; otherwise use the value from
the select. (You'll want to check that at least one has a value anyway.)

-- 
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.



[Rails] Question about rails generate controller

2011-08-09 Thread Pepe Sanchez
Hi all

Is there a way to run 2 or more times the controller command to add
methods to a specific controller?

can I run:

rails generate controller ControllerName index

rails generate controller ControllerName add

rails generate controller ControllerName update

thanks

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

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



[Rails] Re: Invoking browser from Ruby script with URL argument: How?

2011-08-09 Thread RichardOnRails
Hi again,

 Do you have a further idea?

 Well, I provided a link.

Thanks for that link in your second post.  I only received it about an
hour after your original response, which only pointed out that I
lacked a function reference.  Hence my request for further idea(s).

Now I have a wealth of good solutions: Yours, Colin's and Fred's

Thanks to you and them,
Richard

On Aug 8, 7:32 pm, 7stud -- li...@ruby-forum.com wrote:
 RichardOnRails wrote in post #1015562:

  Hi 7-stud,

  Long time no see.  Thanks for looking into my question.

  file://K:/_Utilities/Apache/xampp/apache/htdocs/index.html

  isn't a command.

  Yeah, I know, but my question is how to repair my code so that it
  works.  Or more specifically,  what command can I take which accepts
  the text of a URL as an argument and invokes my browser with that
  command as an argument?

  Do you have a further idea?

 Well, I provided a link.

 --
 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: Nesting select and text_field in radio_button

2011-08-09 Thread Jarek Plonski
 Why bother with the radio buttons?

 If there's something in the text field use it; otherwise use the value
 from
 the select. (You'll want to check that at least one has a value anyway.)

Is it possible to check it in view or only in controller after 
submitting the form??

This one is only populating :place param from the last :place field

= form_for @meeting do |f|
  ...
  .field
= f.label :place
= f.text_field :place
  .field
= f.label :place
= f.select  :place, options_for_select(Meeting.places, 
params[:place])
  .field
= f.label :total_places
= f.text_field :total_places
  .actions
= f.submit 'Save'


I'm newbie and haven't seen similar form in books.

Other idea is to populate text from select box into text_field - how 
about that??

-- 
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] Bundle Install failing on deployment

2011-08-09 Thread paul h
Hi,

I have upgraded an app to 3.1.0.rc5 and everything is fine locally.
When I try to deploy with capistrano, bundle install fails with the
following output:

 ** [out :: westminster-agency.co.uk] Fetching source index for
http://rubygems.org/
 ** [out :: westminster-agency.co.uk] which: no sudo in (/usr/local/
sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)
 ** [out :: westminster-agency.co.uk] Using rake (0.9.2)
 ** [out :: westminster-agency.co.uk] Using multi_json (1.0.3)
 ** [out :: westminster-agency.co.uk] Using activesupport (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using bcrypt-ruby (2.1.4)
 ** [out :: westminster-agency.co.uk] Using builder (3.0.0)
 ** [out :: westminster-agency.co.uk] Using i18n (0.6.0)
 ** [out :: westminster-agency.co.uk] Using activemodel (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using erubis (2.7.0)
 ** [out :: westminster-agency.co.uk] Using rack (1.3.2)
 ** [out :: westminster-agency.co.uk] Using rack-cache (1.0.2)
 ** [out :: westminster-agency.co.uk] Using rack-mount (0.8.1)
 ** [out :: westminster-agency.co.uk] Using rack-test (0.6.1)
 ** [out :: westminster-agency.co.uk] Using hike (1.2.0)
 ** [out :: westminster-agency.co.uk] Using tilt (1.3.2)
 ** [out :: westminster-agency.co.uk] Using sprockets (2.0.0.beta.13)
 ** [out :: westminster-agency.co.uk] Using actionpack (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using mime-types (1.16)
 ** [out :: westminster-agency.co.uk] Using polyglot (0.3.2)
 ** [out :: westminster-agency.co.uk] Using treetop (1.4.10)
 ** [out :: westminster-agency.co.uk] Using mail (2.3.0)
 ** [out :: westminster-agency.co.uk] Using actionmailer (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using arel (2.1.4)
 ** [out :: westminster-agency.co.uk] Using tzinfo (0.3.29)
 ** [out :: westminster-agency.co.uk] Using activerecord (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using activeresource (3.1.0.rc5)
 ** [out :: westminster-agency.co.uk] Using addressable (2.2.6)
 ** [out :: westminster-agency.co.uk] Using ansi (1.3.0)
 ** [out :: westminster-agency.co.uk] Using bcat (0.6.1)
 ** [out :: westminster-agency.co.uk] Using ffi (1.0.9)
 ** [out :: westminster-agency.co.uk] Using childprocess (0.2.0)
 ** [out :: westminster-agency.co.uk] Using diff-lcs (1.1.2)
 ** [out :: westminster-agency.co.uk] Using json (1.5.3)
 ** [out :: westminster-agency.co.uk] /usr/local/lib/ruby/site_ruby/
1.9.1/rubygems/specification.rb:575:in `normalize_yaml_input': invalid
byte sequence in US-ASCII (ArgumentError
 ** [out :: westminster-agency.co.uk] )
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/specification.rb:487:in `from_yaml'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_input.rb:190:in `load_gemspec'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_input.rb:55:in `block in
initialize'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_input.rb:35:in `initialize'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_input.rb:20:in `new'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package/tar_input.rb:20:in `open'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/package.rb:44:in `open'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/format.rb:62:in `from_io'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/format.rb:46:in `block in from_file_by_path'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/1.9.1/
open-uri.rb:35:in `open'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/1.9.1/
open-uri.rb:35:in `open'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/
site_ruby/1.9.1/rubygems/format.rb:45:in `from_file_by_path'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/gems/
1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:100:in
`spec_from_gem'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/gems/
1.9.1/gems/bundler-1.0.15/lib/bundler/source.rb:77:in `fetch'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/gems/
1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:50:in `block in
run'
 ** [out :: westminster-agency.co.uk] from /usr/local/lib/ruby/gems/
1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in
each'
 ** [out :: westminster-agency.co.uk] 

Re: [Rails] Re: How can I disable Rails 3.1's ActiveRecord Query Caching?

2011-08-09 Thread Hassan Schroeder
On Mon, Aug 8, 2011 at 6:46 PM, Phoenix Rising polarisris...@gmail.com wrote:
 Thanks again for your help, Hassan.  Unfortunately it's still caching
 queries.  I've tried both approaches in this thread in isolation, and
 together, and regardless, the query cache is still being used.

 First, I created an initializer: config/initializers/active_record.rb
 with ActiveRecord::Base.connection.disable_query_cache! inside it, and
 then used config.middleware.delete ActiveRecord::QueryCache in config/
 environments/development.rb inside the configure block.

I haven't played with 3.1 at all yet, so I'm swinging in the dark but --
does `rake middleware` list QueryCache or no?

-- 
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: Nesting select and text_field in radio_button

2011-08-09 Thread Hassan Schroeder
On Tue, Aug 9, 2011 at 7:53 AM, Jarek Plonski li...@ruby-forum.com wrote:

 Is it possible to check it in view or only in controller after
 submitting the form??

You need that information in the controller, so might as well put the
logic there (IMO).

 This one is only populating :place param from the last :place field

The two form elements need to have different names.

-- 
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] Nesting select and text_field in radio_button

2011-08-09 Thread Walter Lee Davis


On Aug 9, 2011, at 8:49 AM, Jarek Plonski wrote:


I'm creating my first Rails app and need an idea creating forms.

I have Meeting model with place attribute.

I want to have two fields for Meeting.place = one would be select with
places from other meetings or text_field if the place is being used
first time. User would be selecting radio_button of which field he has
used.

So is there any way to nest select and text_field within 2
radio_buttons?

I would appreciate any other solution ideas too.
Cheers



Here's how I usually solve this (requires Prototype, you'll have to  
translate if you're using jQuery):


script type=text/javascript
if($('user_practice_id')){
		$('user_practice_id').options[$('user_practice_id').options.length]  
= new Option('New...','New...');

$('user_practice_id').observe('change',function(evt){
if($F(this) == 'New...'){
var text_input = new Element('input', 
{type:'text',size:'60',name:'practice_name',id:'practice_name'});

this.insert({before:text_input});
text_input.focus();
text_input['_bak'] = $ 
('user_practice_id').hide().options.selectedIndex = 0;

text_input.observe('blur',function(evt){
if($F(this) == ''  this._bak){
this._bak.show();
this.remove();
}
});
}
});
}
/script

In the controller, I test for the presence of the practice_name  
attribute, and if it's there, create a new Practice before assigning  
the practice to the User.


  if( params[:practice_name]  )
practice = Practice.create({:name = params['practice_name']})
params[:user][:practice_id] = practice.id
  end
  # regular save/update here

This gets you a combo-box, where you can choose, or add new, in one  
interface slot.


Walter


--
You received this message because you are subscribed to the Google Groups Ruby on 
Rails: Talk group.
To post to this group, send email to rubyonrails-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 about rails generate controller

2011-08-09 Thread Chris Kottom
No, but you can call this:

rails generate controller ControllerName index add update

On Tue, Aug 9, 2011 at 4:17 PM, Pepe Sanchez li...@ruby-forum.com wrote:

 Hi all

 Is there a way to run 2 or more times the controller command to add
 methods to a specific controller?

 can I run:

 rails generate controller ControllerName index

 rails generate controller ControllerName add

 rails generate controller ControllerName update

 thanks

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

 --
 You received this message because you are subscribed to the Google Groups
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-talk@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+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] Question about mechanize and input type image

2011-08-09 Thread art tav
Hello i'm having a issue trying to submit a form using mechanize. The
thing
is that the form don't have a submit button but a input type=image.

Someone knows how to do this with mechanize or if its not possible
with mechanize there is another library to do this?

This is the form im trying to send




form action=index.php method=post
tr
  td class=inptextbUser name/b/td

  tdinput name=uname size=10/td
/tr

tr
  td class=inptextbPassword/b/td
  tdinput name=upass size=10 type=password/td
/tr

tr
  td align=center colspan=2

  table cellspacing=0 cellpadding=0 border=0
  tr
  td align=rightinput name=urem type=checkbox
value=remember/td
  td class=inptextRemember me/td
  /tr
  /table
  /td
/tr

tr
  td colspan=2 align=center
  input type=image border=0 src=images/submit.gif
  /td
/tr
tr
   td colspan=2 align=centera class=TopNav
href=http://www.sendsmsnow.com/forgetpass.php;Forgot
password?/a/td
/tr

/form

-- 
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: CanCan doesn't work on this model

2011-08-09 Thread Leonel *.*
I kept on simplifying the code to get to the root of the problem and it 
seems it won't work regardless of what I do.

in ability.rb
can :manage, :all

so it's supposed to allow the user to do ANYTHING right? wrong!

if in users_controller.rb I tried working with nested resources, it 
ALWAYS gives me Access Denied error.

users_controller.rb
load_resource :company
load_resource :user, :through = :company

-- 
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] Question about mechanize and input type image

2011-08-09 Thread Colin Law
On 9 August 2011 17:13, art tav li...@ruby-forum.com wrote:
 Hello i'm having a issue trying to submit a form using mechanize. The
 thing
 is that the form don't have a submit button but a input type=image.

 Someone knows how to do this with mechanize or if its not possible
 with mechanize there is another library to do this?

 This is the form im trying to send




 form action=index.php method=post
 tr

I think the problem may be that you are trying to nest a form within a
table.  The only way you can put a form inside a table is if the form
lies entirely within one cell of the table.  A table may reside
entirely within a form of course.

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] Re: CanCan doesn't work on this model

2011-08-09 Thread Walter Lee Davis


On Aug 9, 2011, at 12:39 PM, Leonel *.* wrote:

I kept on simplifying the code to get to the root of the problem and  
it

seems it won't work regardless of what I do.

in ability.rb
can :manage, :all

so it's supposed to allow the user to do ANYTHING right? wrong!

if in users_controller.rb I tried working with nested resources, it
ALWAYS gives me Access Denied error.

users_controller.rb
load_resource :company
load_resource :user, :through = :company


Try changing this to simply:

#users_controller.rb
load_and_authorize_resource

I believe that will get all of the nested stuff automagically, you  
don't have to specify the relationship. After all, that's what your  
models are for.


Walter

--
You received this message because you are subscribed to the Google Groups Ruby on 
Rails: Talk group.
To post to this group, send email to rubyonrails-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 about mechanize and input type image

2011-08-09 Thread art tav
I'm not sure if that's the problem because i can work with the form 
assing values to the fields of uname and upass. I've tried to find a 
solution for this issue in google but couldn't find a solution that 
works.

May be a little more information will help i'm using mechanize 2.0.1 and 
this is some of the code that i use for sending the form.

page = agent.get(url_mail)

log = page.forms.first
log.uname = user
log.upass = password

logeado = agent.submit(log)#i used this after other unsuccessful atempts 
to
#submit the form. I'm not sure if the agent.submit is clicking the right
#button but it returns a response but...
sl = logeado.field(country) #i got the error undefined method 'field' 
for Mechanize::page:0

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

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-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] Passenger running Rails site on GlusterFS

2011-08-09 Thread rtacconi
I would like to use GlusterFS to share Rails applications. Rails apps
will run using Apache and Passenger. Do you see any problem in sharing
Rails files? What about the tmp directory? If you do not know
GlusterFS, it is like NFS but HA and load-balanced.

The idea is to deploy in one point, and immediately share the code
with all servers. Plus any file uploaded or anything in /public will
be shared immediately.

I am waiting for the second server to test this solution but I would
like to know your thoughts.

-- 
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] Devise AssociationTypeMismatch

2011-08-09 Thread Pete
My site is using Devise and Cancan.  Currently I have 3 roles setup
I am testing creating a new user using the following command (role is
required):

curl -H Content-Type:application/json -H Accept:application/json -
d {\user\:{\email\:\tes...@test.com\, \role\:\2\, \name\:
\name01\, \password\:\passwd\}} http://127.0.0.1:3000/users

and get the following error:

ActiveRecord::AssociationTypeMismatch
in RegistrationsController#create
Role(#70259472646000) expected, got String(#70259436671420)

I also tried using \role\:\member\

I think the problem is how I am passing in the role, but I am unsure
what else to try.

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: How can I update a div value using Ajax but calling a function on the OnChange?

2011-08-09 Thread 7stud --
Kleber Shimabuku wrote in post #1015666:
 any advice? blog post?


This works for me:

h1Users#new/h1
pFind me in app/views/users/new.html.erb/p

%= link_to Click me,
{:controller = 'users', :action = 'get_info'},
:remote = true %

div id=update_meHello/div
divworld/div


===


class UsersController  ApplicationController
  def new
@title = Sign up
  end

  def get_info
@data = 'world'
  end

end



!DOCTYPE html
html
head
  title%= @title %/title
  %= csrf_meta_tag %
  %= javascript_include_tag :defaults %
/head
body

  %= yield %

/body
/html

===


TestApp::Application.routes.draw do

  get users/get_info



===app/views/users/get_info.js.erb

$(update_me).update(%= @data %);

-- 
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] raw sql query-update

2011-08-09 Thread Angelo Cordova
Hi people

I need to write a raw sql query in rails 3. But I don't know where
should I do this, in the model or in the controller?

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] Devise AssociationTypeMismatch

2011-08-09 Thread John Winters
Try passing \role_id\:\2\.

I started seeing this in my tests as soon as I updated to 3.1rc5.  It didn't
happen with 3.1rc4.

HTH
John

On 9 August 2011 18:09, Pete g...@elusivestars.com wrote:

 My site is using Devise and Cancan.  Currently I have 3 roles setup
 I am testing creating a new user using the following command (role is
 required):

 curl -H Content-Type:application/json -H Accept:application/json -
 d {\user\:{\email\:\tes...@test.com\, \role\:\2\, \name\:
 \name01\, \password\:\passwd\}} http://127.0.0.1:3000/users

 and get the following error:

 ActiveRecord::AssociationTypeMismatch
 in RegistrationsController#create
 Role(#70259472646000) expected, got String(#70259436671420)

 I also tried using \role\:\member\

 I think the problem is how I am passing in the role, but I am unsure
 what else to try.

 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.



[Rails] junction table question

2011-08-09 Thread Mickey Cowden
I'm looking into how to implement a relationship between some models,
and I think I need to use a junction table.  From the documentation I've
read, a junction table doesn't require a model.  But from my controller,
I'm not sure how to get the data I need.  Here's a description of my
models and what I need in my controller:

Models
1. Event
2. Site
3. Participant

Relationships:
1. An event can have multiple sites (example video conferencing)
2. A site can have multiple events
3. Participant goes to an event at a location

Database Tables:
1. event_sites (:id, :event_id, :site_id)
2. participants (:id, :event_site_id, ...)

And in my participant controller, I need to get the sites available for
a particular event the participant is signing up for (new action).  Any
thoughts on how I can get that data from the junction table, or a better
approach in general?  Thanks.

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

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



Re: [Rails] junction table question

2011-08-09 Thread Walter Lee Davis


On Aug 9, 2011, at 2:25 PM, Mickey Cowden wrote:


I'm looking into how to implement a relationship between some models,
and I think I need to use a junction table.  From the documentation  
I've

read, a junction table doesn't require a model.


That's in the basic has_and_belongs_to_many relationship. You just  
provide a table with modela_id and modelb_id in it, and the  
relationship takes care of the rest.



But from my controller,
I'm not sure how to get the data I need.  Here's a description of my
models and what I need in my controller:

Models
1. Event
2. Site
3. Participant


This is a rich relationship, described in the has_many :through  
relationship. This is a full model-backed join object, not the  
lightweight join table in habtm. You will need a model (although you  
won't need a separate controller) to get at any of the data stored in  
this relationship.


Walter



Relationships:
1. An event can have multiple sites (example video conferencing)
2. A site can have multiple events
3. Participant goes to an event at a location

Database Tables:
1. event_sites (:id, :event_id, :site_id)
2. participants (:id, :event_site_id, ...)

And in my participant controller, I need to get the sites available  
for
a particular event the participant is signing up for (new action).   
Any
thoughts on how I can get that data from the junction table, or a  
better

approach in general?  Thanks.

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

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




--
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: CanCan doesn't work on this model

2011-08-09 Thread Leonel *.*
Ok, I read the CanCan documentation more carefully and this jumped out 
the screen...
This will fetch the project using Project.find(params[:project_id]) on 
every controller action, save it in the @project instance variable...

When I was going to /users the companies resource was empty and it would 
throw the Access Denied error unless I used shallow nesting (:shallow = 
true).

So I should've been going to /companies/45/users instead. Then companies 
get loaded as well as users. My problem with this is that it can only 
display users from a certain company.

I'm still not accomplishing what I want. Because the page should display 
all companies and all users under each company. I'm closer to finding 
the answer than I was before. I'll keep on trying.

-- 
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: How can I update a div value using Ajax but calling a function on the OnChange?

2011-08-09 Thread 7stud --
You can make your js more general by doing this:

h1Users#new/h1
pFind me in app/views/users/new.html.erb/p

%= link_to Click me,
  {:controller = 'users',
   :action = 'get_info',
   :my_target = 'update_me'},

   :remote = true %

div id=update_meHello/div
divworld/div


===

class UsersController  ApplicationController
  def new
@title = Sign up
  end

  def get_info
@target = params[:my_target]
@data = 'world'
  end

end

==app/views/users/get_info.js.erb

$(%= @target %).update(%= @data %);

-- 
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: CanCan doesn't work on this model

2011-08-09 Thread Leonel *.*
Ok. This is the question I'm looking the answer for: how can I load and 
authorize the companies in the users_controller.rb file?

I already tried load_and_authorize_resource :company

@companies and @company are empty in the view.

-- 
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: junction table question

2011-08-09 Thread Mickey 13
Thanks Walter for your reply.  I had thought the two techniques equal 
(has_and_belongs_to_many and has_many :through).  Thanks for the 
insight.

-- 
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] Re: Question about mechanize and input type image

2011-08-09 Thread Colin Law
On 9 August 2011 17:59, art tav li...@ruby-forum.com wrote:
 I'm not sure if that's the problem because i can work with the form
 assing values to the fields of uname and upass. I've tried to find a
 solution for this issue in google but couldn't find a solution that
 works.

The first thing to do is to get to valid html.  You cannot make any
conclusions about anything with invalid html.  To check that it is
valid view the page source (View  Page Source or similar in your
browser) copy the complete text and paste it into the w3c html
validator.  When you have invalid html the browser (which will know
that it is invalid) has to guess what you meant and it may not guess
the way you intended.

There is no point doing anything else until you have valid html.  A
golden rule of problem solving, if you know that something is not
right then fix it before worrying about other things that may or may
not be part of the problem.

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] raw sql query-update

2011-08-09 Thread Colin Law
On 9 August 2011 18:34, Angelo Cordova acord...@gmail.com wrote:
 Hi people

 I need to write a raw sql query in rails 3. But I don't know where
 should I do this, in the model or in the controller?

If you are not sure where it should be then firstly I would ask
whether you are sure you need to write a raw sql query.  If you do
need to do that then almost always it should be in a model.  However
without knowing more details of what it does and why, it is impossible
to give an absolute answer.

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: Re: Question about mechanize and input type image

2011-08-09 Thread art tav
Colin Law wrote in post #1015781:

 The first thing to do is to get to valid html.  You cannot make any
 conclusions about anything with invalid html.  To check that it is
 valid view the page source (View  Page Source or similar in your
 browser) copy the complete text and paste it into the w3c html
 validator.  When you have invalid html the browser (which will know
 that it is invalid) has to guess what you meant and it may not guess
 the way you intended.

 There is no point doing anything else until you have valid html.  A
 golden rule of problem solving, if you know that something is not
 right then fix it before worrying about other things that may or may
 not be part of the problem.

 Colin

Thanks for this information, i didn't know that w3s have a validator for 
html, now i can use it to check things faster that using firebug or 
other things.

It seems like the site have a lot of things wrong, like i spected for 
what i saw the first time in the source code, but the thing here is that 
i don't own that site so i can't do something about that issues.

-- 
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] Uglifier on 3.1

2011-08-09 Thread Jamie Gaskins
I'm having trouble with my JS/CoffeeScripts not being minified for
production.  Both my jQuery and my individual .coffee files are being
sent as full-text JS both locally (on WEBrick, Thin and Unicorn) in
production mode and when deployed to Heroku (using Unicorn).  rake
assets:precompile is not minifying the output.  Here are my Gemfile,
application.rb and production.rb:

https://gist.github.com/1134330

If there's anything else you need to know, I'll be happy to provide it.

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



[Rails] Re: Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-09 Thread Mohammed Aslam
Just found the slides of Fedena RubyConf 2010 presentation @ Slideshare 
http://www.slideshare.net/arvindpotti/ruby-conf-india-project-fedena-why-ro-r-3496151

-- 
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/-/En_Y_L9paScJ.
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] A single column with foreign keys from Multiple tables

2011-08-09 Thread Rahul
Hi,

  Consider this scenario, I have a table which stores the
likes and it would stores the likes from all sorts of tables like
blogs,comments, postings, reviews, etc. So the table has the following
columns(id, like_id and type) where like_id is the id from any of the
previous mentioned tables and type would be single char column to
identify the foreign key table(B for blog, C for comments and so on).
How am i supposed to create the relation between like table and the
other tables?

-- 
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: raw sql query-update

2011-08-09 Thread Angelo Cordova
Well

I have two non related models, but I need to update an attribute value
of one model using a value from the other one. I've tried using
callbacks(after_create update_attribute), but it didn't work because
they are not related and because I need extra conditions. So I think
I could solve this using a raw sql query

On Aug 9, 3:43 pm, Colin Law clan...@googlemail.com wrote:
 On 9 August 2011 18:34, Angelo Cordova acord...@gmail.com wrote:

  Hi people

  I need to write a raw sql query in rails 3. But I don't know where
  should I do this, in the model or in the controller?

 If you are not sure where it should be then firstly I would ask
 whether you are sure you need to write a raw sql query.  If you do
 need to do that then almost always it should be in a model.  However
 without knowing more details of what it does and why, it is impossible
 to give an absolute answer.

 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] Adding elementos into a collection

2011-08-09 Thread Tomas R.
So I have this

Event
  has_many :assistance
  has_many :users, :through = :assistance

User
  has_many :assistance
  has_many :assisted_events, :through = :assistance, :source =
:assistance

Assistance
  belongs_to :user
  belongs_to :event

Users assisting to events are assigned using

@event.users  user
BUT assistance model also have an status attribute, so I need to fill it
at the same time of doing @event.users  user, is it possible to make
it on the same line? I actually dont know how to assign that attribute

-- 
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] step-wise refactoring and has-one

2011-08-09 Thread Peter Bell
Hi There,

Wondering if anyone has thoughts on this. Right now my User has lots of 
responsibilities. I want to start to move some of them from a User to a Profile 
(where a user has-one Profile). I don't want to do any big refactorings, so I 
want to take small steps so I can commit working code that I could push to 
master if necessary every hour or so.

I was trying to get User to delegate :bio, :website, :to = :@current_profile 
(real situation has a lot more complexity, but that's the first step).

Trying to figure out best approach to this because of course when factories 
(Factory_girl) or my code call a user, they want to call user.bio and 
user.bio=, so before they call I have to ensure that I have an @current_profile.

How does Ruby actually call instance variables? Does it make sense for me to 
def a method to overload the getter for the current_profile instance variable 
that looks to see if the actual instance variable exists and if not 
finds/creates it?

Just trying to find the best way to approach the problem. Any input much 
appreciated.

Best Wishes,
Peter

-- 
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] Adding elementos into a collection

2011-08-09 Thread Hassan Schroeder
On Tue, Aug 9, 2011 at 1:56 PM, Tomas R. li...@ruby-forum.com wrote:

 Users assisting to events are assigned using

 @event.users  user
 BUT assistance model also have an status attribute, so I need to fill it
 at the same time of doing @event.users  user, is it possible to make
 it on the same line? I actually dont know how to assign that attribute

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html

Look for Association callbacks

-- 
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.



[Rails] gem install mysql2 :: Error cannot find -lmysqlclient_r

2011-08-09 Thread Dinooz
I install rvm in Fedora 15. like listed in the post:
https://plus.google.com/106336405206268952858/posts/g1URhoYF3qk

Also like to use MySQL, but when I try to install the gem for mysql2:

gem install mysql2

Script started on Mon 08 Aug 2011 12:48:23 PM CDT
 ]0;myredhat@myfedora15:~/rails  [?1034h[myredhat@myfedora15 rails]$
su - [2Pll  clear df -h clear  [K  [K  [K  [K  [K gem
install mysql2

Building native extensions. This could take a while...

ERROR: Error installing mysql2:

ERROR: Failed to build gem native extension.



/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb

checking for rb_thread_blocking_region()... yes

checking for mysql.h... yes

checking for errmsg.h... yes

checking for mysqld_error.h... yes

creating Makefile



make

gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -
DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/
include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-
pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -
Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-
strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -
funroll-loops -o mysql2_ext.o -c mysql2_ext.c

gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -
DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/
include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-
pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -
Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-
strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -
funroll-loops -o client.o -c client.c

gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -
DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/
include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-
pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -
Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-
strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -
funroll-loops -o result.o -c result.c

result.c: In function ‘rb_mysql_result_fetch_row’:

result.c:253:31: warning: variable ‘tokens’ set but not used [-Wunused-
but-set-variable]

result.c:267:58: warning: variable ‘tokens’ set but not used [-Wunused-
but-set-variable]

result.c:310:33: warning: variable ‘tokens’ set but not used [-Wunused-
but-set-variable]

result.c: In function ‘rb_mysql_result_fetch_fields’:

result.c:376:35: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]

gcc -shared -o mysql2.so mysql2_ext.o client.o result.o -L. -L/usr/
local/rvm/rubies/ruby-1.9.2-p290/lib -Wl,-R/usr/local/rvm/rubies/
ruby-1.9.2-p290/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/
lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p290/lib -L/usr/local/
rvm/rubies/ruby-1.9.2-p290/lib -lruby -L/usr/lib -lmysqlclient_r -
lpthread -lm -lrt -ldl -lpthread -lrt -ldl -lcrypt -lm -lc

/usr/bin/ld: cannot find -lmysqlclient_r

collect2: ld returned 1 exit status

make: *** [mysql2.so] Error 1





Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.2-p290/
gems/mysql2-0.3.6 for inspection.

Results logged to /usr/local/rvm/gems/ruby-1.9.2-p290/gems/
mysql2-0.3.6/ext/mysql2/gem_make.out

 ]0;myredhat@myfedora15:~/rails [myredhat@myfedora15 rails]$ rpm -qa |
grep MySQL

 [01;31m [KMySQL [m [K-server-5.5.15-1.linux2.6.i386

 [01;31m [KMySQL [m [K-devel-5.5.15-1.linux2.6.i386

 [01;31m [KMySQL [m [K-shared-compat-5.5.15-1.linux2.6.i386

 [01;31m [KMySQL [m [K-client-5.5.15-1.linux2.6.i386

 ]0;myredhat@myfedora15:~/rails [myredhat@myfedora15 rails]$ uname -a

Linux myfedora15 2.6.38.8-32.fc15.i686 #1 SMP Mon Jun 13 20:01:50 UTC
2011 i686 i686 i386 GNU/Linux

 ]0;myredhat@myfedora15:~/rails [myredhat@myfedora15 rails]$ exit

exit


Script done on Mon 08 Aug 2011 12:49:05 PM CDT

I try to upgrade but nothing seems to work... I wonder if this is a
ruby/gem issue or some missing library in the mysql client. !!!.

THX in advance for the heads up.



Edited 1 time(s). Last edit at 08/09/2011 03:31PM by Bernardino Lopez.

-- 
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 

Re: [Rails] step-wise refactoring and has-one

2011-08-09 Thread Chris Mear
On 9 Aug 2011, at 22:08, Peter Bell wrote:

 Wondering if anyone has thoughts on this. Right now my User has lots of 
 responsibilities. I want to start to move some of them from a User to a 
 Profile (where a user has-one Profile). I don't want to do any big 
 refactorings, so I want to take small steps so I can commit working code that 
 I could push to master if necessary every hour or so.
 
 I was trying to get User to delegate :bio, :website, :to = :@current_profile 
 (real situation has a lot more complexity, but that's the first step).
 
 Trying to figure out best approach to this because of course when factories 
 (Factory_girl) or my code call a user, they want to call user.bio and 
 user.bio=, so before they call I have to ensure that I have an 
 @current_profile.

As an aside: if your User has_one Profile, then normally you'd just access that 
via User's instance method 'profile', which ActiveRecord provides. Is there a 
particular reason you need to use a separate instance variable to reference the 
profile?

 How does Ruby actually call instance variables? Does it make sense for me to 
 def a method to overload the getter for the current_profile instance variable 
 that looks to see if the actual instance variable exists and if not 
 finds/creates it?

AFAIK, there isn't any way to hook into the access of an instance variable. 
Overriding a getter method will only work if you only ever access that instance 
variable via the getter method and not directly; unfortunately for your case, 
ActiveSupport's Delegation module will generate code that accesses your 
@current_profile instance variable directly.

As a first attempt, I'd probably just use ActiveRecord's after_initialize hook 
in User to make sure I find/create a profile whenever a new User instance is 
made.

Not sure if that approach will play well with your factories, but then they 
probably ought to be creating the Profile instance explicitly anyway.

Chris

-- 
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 about mechanize and input type image

2011-08-09 Thread 7stud --
 The
 thing
 is that the form don't have a submit button but a input type=image.


Have you tried writing your code as if it has a submit button?

-- 
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] step-wise refactoring and has-one

2011-08-09 Thread Peter Bell

On Aug 9, 2011, at 5:43 PM, Chris Mear wrote:

 On 9 Aug 2011, at 22:08, Peter Bell wrote:
 As an aside: if your User has_one Profile, then normally you'd just access 
 that via User's instance method 'profile', which ActiveRecord provides. Is 
 there a particular reason you need to use a separate instance variable to 
 reference the profile?

Yeah - MongoMapper. I keep on running into issues with the has_one 
relationship, so I'm persisting a current_profile_id as an ObjectId and I need 
to handle the retrieval of the profile usine a Profile.find(current_profile_id)

 
 How does Ruby actually call instance variables? Does it make sense for me to 
 def a method to overload the getter for the current_profile instance 
 variable that looks to see if the actual instance variable exists and if not 
 finds/creates it?
 
 AFAIK, there isn't any way to hook into the access of an instance variable. 
 Overriding a getter method will only work if you only ever access that 
 instance variable via the getter method and not directly; unfortunately for 
 your case, ActiveSupport's Delegation module will generate code that accesses 
 your @current_profile instance variable directly.

Hmmm, OK, thanks

 As a first attempt, I'd probably just use ActiveRecord's after_initialize 
 hook in User to make sure I find/create a profile whenever a new User 
 instance is made.

I can't find support for after_initialize in MM unfortunately 
(http://mongomapper.com/documentation/plugins/callbacks.html), but I can look 
for the closest possible on the MM list.

 Not sure if that approach will play well with your factories, but then they 
 probably ought to be creating the Profile instance explicitly anyway.

That's certainly something I can do. So probably use a callback for the runtime 
code and just pass in the object in the factories. Seems like a way I can go - 
thanks!

Best WIshes,
Peter

 
 Chris
 
 -- 
 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: How can I update a div value using Ajax but calling a function on the OnChange?

2011-08-09 Thread Kleber Shimabuku
Thank you guys, but as I said in the topic, I looking how to perform
this on event OnChange of an select



On Aug 10, 4:04 am, 7stud -- li...@ruby-forum.com wrote:
 You can make your js more general by doing this:

 h1Users#new/h1
 pFind me in app/views/users/new.html.erb/p

 %= link_to Click me,
           {:controller = 'users',
            :action = 'get_info',
            :my_target = 'update_me'},

            :remote = true %

 div id=update_meHello/div
 divworld/div

 ===

 class UsersController  ApplicationController
   def new
     @title = Sign up
   end

   def get_info
     @target = params[:my_target]
     @data = 'world'
   end

 end

 ==app/views/users/get_info.js.erb

 $(%= @target %).update(%= @data %);

 --
 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: How can I update a div value using Ajax but calling a function on the OnChange?

2011-08-09 Thread Kleber Shimabuku
Just updating:

I have this on a partial:

p class=fields
  %= f.collection_select(:part_id, @parts, :id, :title, { :prompt =
true } , { :onchange = load_part_price_select(this.id,
this.options[this.selectedIndex].value);  } ) %
  span class='part_price' _ _ _ _ /span
  %= f.hidden_field :_destroy %
  %= link_to_remove_fields remove, f %
/p


and the relative function on application.js file:

function load_part_price_select(id, value) {
alert(id);
alert(value);
$('#' + id ).live('change',function() {
$.ajax({
  url: value + '/retrieve_part_price/',
  success: function(responseData) {
alert('test');
  }
});
});
};

For now, I have to figure out a question about routes

I've created the right method on my ItemsController:

  def retrieve_part_price
@price = Part.find(params[:id])
  end

and configured the routed as:

resources :items do
  get 'retrieve_part_price', :on = :member
end

but the development log shows me an error:


--
Started GET /items/29/8/retrieve_part_price/ for 127.0.0.1 at
2011-08-10 07:22:57 +0900

ActionController::RoutingError (No route matches /items/29/8/
retrieve_part_price):
--

Probably the best way would be something like /items/29/
retrieve_part_price/8

But how to make the route act this way?







On Aug 10, 6:54 am, Kleber Shimabuku klebershimab...@gmail.com
wrote:
 Thank you guys, but as I said in the topic, I looking how to perform
 this on event OnChange of an select

 On Aug 10, 4:04 am, 7stud -- li...@ruby-forum.com wrote:







  You can make your js more general by doing this:

  h1Users#new/h1
  pFind me in app/views/users/new.html.erb/p

  %= link_to Click me,
            {:controller = 'users',
             :action = 'get_info',
             :my_target = 'update_me'},

             :remote = true %

  div id=update_meHello/div
  divworld/div

  ===

  class UsersController  ApplicationController
    def new
      @title = Sign up
    end

    def get_info
      @target = params[:my_target]
      @data = 'world'
    end

  end

  ==app/views/users/get_info.js.erb

  $(%= @target %).update(%= @data %);

  --
  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: will_paginate appending escape=false to every page URL?

2011-08-09 Thread Ezequiel Schwartzman
Mislav MarohniÄ? wrote in post #1015695:
 That might be a bug with older versions. For Rails 3, use will_paginate
 3.0.pre4 or later:

   gem will_paginate, ~ 3.0.pre4

Darn, I feel stupid for not trying that first, thanks haha

-- 
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] Helpers X Partial

2011-08-09 Thread Bruno Meira
Well, I was reading Agile Web Development book and one question
appeared in my head.
When exactly I use partial and when exactly I use helper. As the book
says we could create html code in a shared helper, so Why we need to
use partial or layout instead of on shared helper?

-- 
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] Helpers X Partial

2011-08-09 Thread Rafael Ubaldo
The partial contains reusable markup - implementation of layout code. A helper 
contains reusable functionality for the view in effort to keep the view 
succinct and free of embedded logic.  

On Aug 9, 2011, at 5:39 PM, Bruno Meira wrote:

 Well, I was reading Agile Web Development book and one question
 appeared in my head.
 When exactly I use partial and when exactly I use helper. As the book
 says we could create html code in a shared helper, so Why we need to
 use partial or layout instead of on shared helper?
 
 -- 
 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] Helpers X Partial

2011-08-09 Thread Julian Leviston
Helpers are used inside templates. They're used when there's more ruby that you 
want to use than HTML. Partials are also used inside templates. They're used 
when there's more HTML that you want to use than ruby.

So, for example, text_area is a built in helper method because it takes 
parameters and spits out very customised HTML. Partials are usually used for 
sections of your web app interface you want to reuse on some pages... They'd 
look very ugly when written into a helper method. It's a matter of aesthetics. 

Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
New video up now at http://sensei.zenunit.com/ 
real fastcgi rails deploy process! Check it out now!


On 10/08/2011, at 10:39 AM, Bruno Meira goesme...@gmail.com wrote:

 Well, I was reading Agile Web Development book and one question
 appeared in my head.
 When exactly I use partial and when exactly I use helper. As the book
 says we could create html code in a shared helper, so Why we need to
 use partial or layout instead of on shared helper?
 
 -- 
 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: Helpers X Partial

2011-08-09 Thread Bruno Meira
now I understand
Thx ;D

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-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] Copy Directory in a generator:

2011-08-09 Thread jdkealy
How would you copy an entire directory in a generator?

I've got tinyMCE and want to copy it from my cms to my new app when
running my generator.

-- 
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: weird problem when updating to RC5

2011-08-09 Thread Ryan M.
ryanjmclaughlin wrote in post #1015638:
 same issue here...

arel 2.1.4 downgrade made everything work perfectly, thanks.

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

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



Re: [Rails] Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-09 Thread Manivannan Sivaprakasam
Thanks for the information.

On Sun, Aug 7, 2011 at 7:51 PM, Unni Koroth u...@foradian.com wrote:

 I don't know how many of you are already aware of the Opensource
 Project Fedena - http://www.projectfedena.org/

 Fedena is recently selected by Government of Kerala, India to automate
 13,000 schools with 7million+ students. I guess it is one of the
 largest implementation of a Ruby on Rails code in education sector.

 The project is named as Sampoorna - http://sampoorna.itschool.gov.in/
 News -
 http://ibnlive.in.com/generalnewsfeed/news/digital-super-highway-connecting-schools-soon/760209.html

 This project is into the final stages and expect a huge fan-base of
 ROR in Kerala. The IT@School department of Government of Kerala is
 notable for its achievements related to supporting FOSS
 https://www.itschool.gov.in/achievements.php

 --
 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: Devise AssociationTypeMismatch

2011-08-09 Thread Pete
Sweet! that worked
Thank you very much

On Aug 9, 10:48 am, John Winters jhwint...@gmail.com wrote:
 Try passing \role_id\:\2\.

 I started seeing this in my tests as soon as I updated to 3.1rc5.  It didn't
 happen with 3.1rc4.

 HTH
 John

 On 9 August 2011 18:09, Pete g...@elusivestars.com wrote:







  My site is using Devise and Cancan.  Currently I have 3 roles setup
  I am testing creating a new user using the following command (role is
  required):

  curl -H Content-Type:application/json -H Accept:application/json -
  d {\user\:{\email\:\tes...@test.com\, \role\:\2\, \name\:
  \name01\, \password\:\passwd\}}http://127.0.0.1:3000/users

  and get the following error:

  ActiveRecord::AssociationTypeMismatch
  in RegistrationsController#create
  Role(#70259472646000) expected, got String(#70259436671420)

  I also tried using \role\:\member\

  I think the problem is how I am passing in the role, but I am unsure
  what else to try.

  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.