[Rails] Re: what is mean of Deployment?

2011-04-17 Thread Mohamed Aslam
All most all developers develop application in their local computer.
This is called as development environment. Once your development
completed, you need to move the application to a production server
where other people can use your website. Moving the application from
development environment to production servers called deployment.

Hope you understand.

On Apr 16, 8:32 pm, amritpal pathak  wrote:
> what is meaning of deploy a ruby on rails application?i am new to RoR.
> please somebody explain it
>
> 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] rubygems fail - require hpricot!

2011-04-17 Thread Anush J.
Hi guys,
I wanted to fetch some info from webpage and use it in my db. I read
hpricot is one way to do it. But the problem is I'm unable to use it
with my app. For some reason after successfully installing hpricot it
fails when I try to use it in the rails console.

I've been trying to fix this for the last four-five days. I'm stumped !
I tried re-installing everything and still cant go past the error. Can
some one please help me, I really appreciate it !

I have put down all the info below, I'm running mac os - snow leopard. I
see the same problem on centOS 5.5 too :(

lenovo-t400:gems Anush$ gem install hpricot
Fetching: hpricot-0.8.4.gem (100%)
Building native extensions.  This could take a while...
Successfully installed hpricot-0.8.4
1 gem installed
Installing ri documentation for hpricot-0.8.4...
Installing RDoc documentation for hpricot-0.8.4...
lenovo-t400:gems Anush$

Loading development environment (Rails 3.0.5)
ruby-1.9.2-p180 :001 > require 'rubygems'
 => nil
ruby-1.9.2-p180 :002 > require 'hpricot'
LoadError: no such file to load -- hpricot
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in
`require'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in
`block in require'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
`block in load_dependency'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in
`new_constants_in'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
`load_dependency'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in
`require'
  from (irb):2
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in
`start'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in
`start'
  from
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:23:in
`'
  from script/rails:6:in `require'
  from script/rails:6:in `'

lenovo-t400:dtsV1 Anush$ which -a ruby
/Users/Anush/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
/Users/Anush/.rvm/bin/ruby

lenovo-t400:environments Anush$ vi
/Users/Anush/.rvm/environments/ruby-1.9.2-p180

export
PATH="/Users/Anush/.rvm/gems/ruby-1.9.2-p180/bin:/Users/Anush/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/Anush/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/Anush/.rvm/bin:$PATH"
rvm_path='/Users/Anush/.rvm'
export rvm_path
RUBY_VERSION='ruby-1.9.2-p180'
export RUBY_VERSION
GEM_HOME='/Users/Anush/.rvm/gems/ruby-1.9.2-p180'
export GEM_HOME
GEM_PATH='/Users/Anush/.rvm/gems/ruby-1.9.2-p180'
export GEM_PATH
MY_RUBY_HOME='/Users/Anush/.rvm/rubies/ruby-1.9.2-p180'
export MY_RUBY_HOME
IRBRC='/Users/Anush/.rvm/rubies/ruby-1.9.2-p180/.irbrc'
export IRBRC
rvm_ruby_string='ruby-1.9.2-p180'
export rvm_ruby_string
unset rvm_gemset_name
unset MAGLEV_HOME



lenovo-t400:environments Anush$ find `gem env gemdir`/gems/hpricot-*
-name \*.bundle -ls
16323203   24 -rwxr-xr-x1 Anushstaff   10152 Apr 16
21:24
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.4/ext/fast_xs/fast_xs.bundle
16323242  264 -rwxr-xr-x1 Anushstaff  134968 Apr 16
21:24
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.4/ext/hpricot_scan/hpricot_scan.bundle
16323204   24 -rwxr-xr-x1 Anushstaff   10152 Apr 16
21:24
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.4/lib/fast_xs.bundle
16323243  264 -rwxr-xr-x1 Anushstaff  134968 Apr 16
21:24
/Users/Anush/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.4/lib/hpricot_scan.bundle


lenovo-t400:environments Anush$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
lenovo-t400:environments Anush$ rails -v
Rails 3.0.6
lenovo-t400:environments Anush$ gem -v
1.6.2
lenovo-t400:environments Anush$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180)
[x86_64-darwin10.6.0]
  - INSTALLATION DIRECTORY: /Users/Anush/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/Anush/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/Anush/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
  - GEM PATHS:
 - /Users/Anush/.rvm/gems/ruby-1.9.2-p180
  - GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :benchmark => false
 - :backtrace => false
 - :bulk_threshold => 1000
  - REMOTE SOURCES:
 - http://rubygems.org/

Thanks
Anush

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

[Rails] rspec-2.6.0.rc2 is released!

2011-04-17 Thread David Chelimsky
We're releasing rspec-2.6.0.rc2 as a release candidate as there are some 
internal changes that we'd like to see put through their paces before doing a 
final release. Note that the changes I speak of are internal. There are no new 
deprecations in this release, nor any backward-incompatible changes.

There are, however, some new features that we're really excited about. Please 
do check it out and please do report any issues to the appropriate github issue 
tracker:

* [rspec-core](http://github.com/rspec/rspec-core/issues)
* [rspec-expectations](http://github.com/rspec/rspec-expectations/issues)
* [rspec-mocks](http://github.com/rspec/rspec-mocks/issues)
* [rspec-rails](http://github.com/rspec/rspec-rails/issues)

### rspec-core-2.6.0.rc2

[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.1.rc2)

* Enhancements
  * `shared_context` (Damian Nurzynski)
  * extend groups matching specific metadata with:
  * method definitions
  * subject declarations
  * let/let! declarations
  * etc (anything you can do in a group)
  * `its([:key])` works for any subject with #[]. (Peter Jaros)
  * `treat_symbols_as_metadata_keys_with_true_values` (Myron Marston)
  * Print a deprecation warning when you configure RSpec after defining
an example.  All configuration should happen before any examples are
defined. (Myron Marston)
  * Pass the exit status of a DRb run to the invoking process. This causes
specs run via DRb to not just return true or false. (Ilkka Laukkanen)
  * Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
  * Report excluded filters in runner output (tip from andyl)

* Bug fixes
  * Don't stumble over an exception without a message (Hans Hasselberg)
  * Remove non-ascii characters from comments that were choking rcov (Geoffrey
Byers)
  * Fixed backtrace so it doesn't include lines from before the autorun at_exit
hook (Myron Marston)
  * Include RSpec::Matchers when first example group is defined, rather
than just before running the examples.  This works around an obscure
bug in ruby 1.9 that can cause infinite recursion. (Myron Marston)
  * Don't send example_group_[started|finished] to formatters for empty groups.
  * Get specs passing on jruby (Sidu Ponnappa)
  * Fix bug where mixing nested groups and outer-level examples gave
unpredictable :line_number behavior (Artur Małecki)
  * Regexp.escape the argument to --example (tip from Elliot Winkler)
  * Correctly pass/fail pending block with message expectations

### rspec-expectations-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.1.rc2)

* Enhancments
  * `change` matcher accepts Regexps (Robert Davis)
  * better descriptions for have_xxx matchers (Magnus Bergmark)

* Bug fixes
  * Removed non-ascii characters that were choking rcov (Geoffrey Byers)
  * change matcher dups arrays and hashes so their before/after states can be
compared correctly.
  * Fix the order of inclusion of RSpec::Matchers in
Test::Unit::TestCase and MiniTest::Unit::TestCase to prevent a
SystemStackError (Myron Marston)


### rspec-mocks-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-mocks/compare/v2.5.0...v2.6.1.rc2)

* Enhancements
  * Add support for any_instance.stub and any_instance.should_receive (Sidu
Ponnappa and Andy Lindeman)

* Bug fixes
  * fix bug in which multiple chains with shared messages ending in hashes
failed to return the correct value

### rspec-rails-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-rails/compare/v2.5.0...v2.6.1.rc2)

* Enhancments
  * rails 3 shortcuts for routing specs (Joe Fiorini)
  * support nested resources in generators (Tim McEwan)
  * require 'rspec/rails/mocks' to use `mock_model` without requiring the whole
rails framework

* Bug fixes
  * fix typo in "rake spec:statsetup" (Curtis Schofield)
  * expose named routes in anonymous controller specs (Andy Lindeman)
  * error when generating namespaced scaffold resources (Andy Lindeman)

-- 
You received 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 with resque; parent process doesn't die

2011-04-17 Thread Nilesh
What if I explicitly exit process(using Process.exit(0)) in FooJob#perform 
after line Bar.add_jobs? 

-- 
You received 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] Problem with resque; parent process doesn't die

2011-04-17 Thread Nilesh
 

I am facing problem in resque process. I have following implementation:

/config/resque_schedule.yml

add_jobs_to_queue:
  cron: "15 * * * *"
  class: FooJob
  description: "Find results from class Bar and put on queue"

/app/jobs/foo_job.rb

class FooJob
  @queue = :normal

  def self.perform
Bar.add_jobs
  end
end

app/models/bar.rb

class Bar
  def self.add_jobs
students = find :all
students.each { |student| student.enqueue(:asap) }
  end
end

Here FooJob(queue: normal) is executed using resque scheduler. The 
performmethod in FooJob calls method 
add_jobs from class Bar. In this method, results are found, and put one by 
one on queue asap. So FooJob becomes parent process, and execution of 
'student' becomes child process. So there should be 2 running processes in 
the system when this executes. When execution overs, both processes should 
die automatically. My problem is, the parent process doesn't die though 
child process has finished execution.

'ps aux | grep resque' shows following result on my machine:

root 7205  0.0  0.7 228012 122920 ? Ss Apr13 0:21 resque-1.13.0: Forked 12933 
at 1302843615

Here it states that process 7205 has forked process 12933, but I don't see 
process 12933 running in the system(means it has finished execution)

What should be problem with parent process doesn't die? What is solution on 
this?

Thanks in advance.

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



[Rails] Re: routes question rails 3.0 vs. rails 2.0

2011-04-17 Thread sol.manager
This totally fixed the problem and my app is now properly doing Solr
full text searches of my jobs model. Thank you for the assistance.

> Problem is not the route, then. This line (above) should not have an '='
> sign at the beginning. Try
>
> <% form_tag search_jobs_path, :method => :get do %>
>
>
>
> > 2: 
> > 3:   <%= text_field_tag :query, params[:query] %> <%= submit_tag
> > "Search!" %>
> > 4: 
> > Trace of template inclusion: app/views/jobs/_search_form.html.erb, app/
> > views/jobs/index.html.erb
>
> > > What is the error?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-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] Re: calling methods from one object in another?

2011-04-17 Thread Phil Crissman
Phil


On Sun, Apr 17, 2011 at 8:47 PM, Nathan Domier  wrote:

> Aha! I've figured it out.
>
> In case anyone else is wondering, I have a current_user defined in
> sessions helper, so, I had to include sessionshelper, and set @user =
> current_user!
>

Just in case it helps; if you have a current_user helper, you don't need to
assign anything to @user in a controller at all. You can just use
current_user in your 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.
>
>

-- 
You received 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 3 and Webrick

2011-04-17 Thread radhames brito
if you are under *nix environtment try installing this packages, use the
brew for mac


sudo apt-get install libmysql-ruby libmysqlclient-dev

-- 
You received 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: calling methods from one object in another?

2011-04-17 Thread Nathan Domier
Aha! I've figured it out.

In case anyone else is wondering, I have a current_user defined in 
sessions helper, so, I had to include sessionshelper, and set @user = 
current_user!

-- 
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: calling methods from one object in another?

2011-04-17 Thread Nathan Domier
I wanted to pass it the id of the logged in user.  I have some things 
that I want to show up for some users and not for others.  I wanted to 
use @user.admin? for this, which works fine on the users pages. 
however, since I can't get the @user assignment to work for pages this 
isn't working either :(

-- 
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: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
Also by default if you'd created the app as a MySQL app in the first place:
  encoding: utf8
  reconnect: false
  socket: /var/run/mysqld/mysqld.sock

HTH.

On Sun, Apr 17, 2011 at 6:02 PM, Peter De Berdt
wrote:

>
> On 17 Apr 2011, at 17:04, amrit pal pathak wrote:
>
> On Apr 17, 7:27 am, Chris Kottom  wrote:
>
> Are you planning to continue using sqlite in the production environment?
>
>  Most people don't, but it's not a problem to do so.
>
>
> If not or if the default sqlite settings aren't right for you, then you'll
>
> need to make some changes, but those will depend on the environment you're
>
> deploying into.  But what those should be isn't a question the mailing list
>
> can answer for you without more information.
>
>
>   The production environment setting with sqllite are by
> default .I want to use mysql for production too.So i changed the
> production enviornment settings to
>   production:
>  adapter: mysql
>  database: blog
>  username: root
>  password: 12345
>  pool: 5
>  timeout: 5000
>
>   Is it enough??
>
>
> If you're running Rails 3, you're better off using "mysql2" as the adapter
> and you have to make sure you include the mysql2 gem in your Gemfile too.
> Also, you might want to use a more secure password for MySQL on your
> production server ;-)
>
>
> Best regards
>
>
> Peter De Berdt
>
>  --
> You received 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] Rails 3 render erb text

2011-04-17 Thread Andrew Miehs
Hi all,

I have a file called configure.text.erb in views// directory.

Why does 
render 'configure.text.erb' 
actually work?

How does render know that this is plain text? Does it assume this due to the 
text.erb ending?

How does this actually all plumb together?

And would be the difference in the between using the following two to generate 
html in a controller?
Am I correct in assuming that the first one will only generate html if asked 
for, the other will generate it all the time?
Does something in format.html call "render" ?

respond_to do |format|
  format.html # configure.html.erb
end

and using 

render 'configure.html.erb' 

Rails does a whole lot of great things, but at the moment the magic is 
overwhelming me.
Trying to work out how all this is connected is really confusing.


Thanks for any light you can shed on this.


Best regards,


Andrew

-- 
You received 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: routes question rails 3.0 vs. rails 2.0

2011-04-17 Thread Phil Crissman
On Sun, Apr 17, 2011 at 4:17 PM, sol.manager  wrote:

> The full error message goes something like this:
>
> showing app/views/jobs/_search_form.html.erb where line #1 raised:
>
> compile error
> /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> _search_form.html.erb:1: syntax error, unexpected ')'
> ...obs_path, :method => :get do ).to_s); @output_buffer.concat ...
>  ^
> /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> _search_form.html.erb:6: syntax error, unexpected kENSURE, expecting
> ')'
> /Users/aesthetica/Apps/blank-r2311/app/views/jobs/
> _search_form.html.erb:8: syntax error, unexpected kEND, expecting ')'
> Extracted source (around line #1):
>
> 1: <%= form_tag search_jobs_path, :method => :get do %>
>

Problem is not the route, then. This line (above) should not have an '='
sign at the beginning. Try

<% form_tag search_jobs_path, :method => :get do %>



> 2: 
> 3:   <%= text_field_tag :query, params[:query] %> <%= submit_tag
> "Search!" %>
> 4: 
> Trace of template inclusion: app/views/jobs/_search_form.html.erb, app/
> views/jobs/index.html.erb
>
> >
> > What is the error?
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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] handling validation

2011-04-17 Thread Matt Harrison
Hi list,

I've started migrating to rails 3 and right now I'm getting to grips with the
different methods for handling validation error message.

I've found this on asciiguides which seems good, the first code examples which 
move
the error display handling to a partial:

http://asciicasts.com/episodes/211-validations-in-rails-3

Which works perfectly for the new and create actions, however on the edit and 
update
actions it gives me the following, referring to the first line of the partial:

undefined local variable or method `target' for 
#<#:0xb645683c>

The only difference between the new/create and the edit/update actions is the 
formers
uses @model.save and the latter @model.update_attributes.

If I take out the refence to the partial, replacing the model name back in, 
everything
works fine but really isn't DRY.

I can post full code examples if necessary.

Thanks

Matt


pgp0ePpCxDehs.pgp
Description: PGP signature


[Rails] Re: Adding composite index to pre-existent table

2011-04-17 Thread Federico
Just easy like that...thank you Fred! (that's my name too btw :) )

On 17 Apr, 21:59, Frederick Cheung  wrote:
> On Apr 17, 8:19 pm, Federico  wrote:
>
> > Hello everybody,
> > I'm a newbie in RoR.
> > In order to create a table I've created a migration with the 'rails
> > generate model...' command.
> > Now I would like to add a composite index over two columns of this
> > table with another, new, migration.
> > Is it possible?
>
> of course
>
> > I've read the documentation about the add_index transformation but I
> > can't create the new migration from command line.
> > I think I can edit the 'create table' migration file, but I would like
> > to have a different migration (generated by 'rails' command).
>
> rails generate migration do_blah will create a new migration called
> do_blah
>
> Fred
>
>
>
>
>
>
>
>
>
> > Thanks in advance for your help,
>
> > Federico

-- 
You received 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: routes question rails 3.0 vs. rails 2.0

2011-04-17 Thread sol.manager
The full error message goes something like this:

showing app/views/jobs/_search_form.html.erb where line #1 raised:

compile error
/Users/aesthetica/Apps/blank-r2311/app/views/jobs/
_search_form.html.erb:1: syntax error, unexpected ')'
...obs_path, :method => :get do ).to_s); @output_buffer.concat ...
  ^
/Users/aesthetica/Apps/blank-r2311/app/views/jobs/
_search_form.html.erb:6: syntax error, unexpected kENSURE, expecting
')'
/Users/aesthetica/Apps/blank-r2311/app/views/jobs/
_search_form.html.erb:8: syntax error, unexpected kEND, expecting ')'
Extracted source (around line #1):

1: <%= form_tag search_jobs_path, :method => :get do %>
2: 
3:   <%= text_field_tag :query, params[:query] %> <%= submit_tag
"Search!" %>
4: 
Trace of template inclusion: app/views/jobs/_search_form.html.erb, app/
views/jobs/index.html.erb

>
> What is the error?
>

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



[Rails] Re: Rails 3 Crashing On Windows 7

2011-04-17 Thread cipher_neo
sorry, they are all the gems on my system.

I only use the following: (from Gemfile)

  gem 'annotate-models', :require => 'annotate_models'
  gem 'ruby-debug19'
  gem 'populator'
  gem 'faker'
  gem "mongrel", '1.2.0.pre2'





On Apr 16, 4:20 pm, cipher_neo  wrote:
> sure:
>
> C:\Windows\System32>gem list
>
> *** LOCAL GEMS ***
>
> abstract (1.0.0)
> actionmailer (3.0.5)
> actionpack (3.0.5)
> activemodel (3.0.5)
> activerecord (3.0.5)
> activeresource (3.0.5)
> activesupport (3.0.5, 2.3.11)
> annotate-models (1.0.4)
> archive-tar-minitar (0.5.2)
> arel (2.0.9)
> builder (2.1.2)
> bundler (1.0.10)
> cgi_multipart_eof_fix (2.5.0)
> columnize (0.3.2)
> configuration (1.2.0)
> diff-lcs (1.1.2)
> erubis (2.6.6)
> extlib (0.9.15)
> faker (0.9.5)
> gem_plugin (0.2.3)
> heroku (1.19.1)
> highline (1.6.1)
> i18n (0.5.0)
> launchy (0.3.7)
> linecache19 (0.5.11)
> mail (2.2.15)
> mime-types (1.16)
> minitest (1.6.0)
> mongrel (1.2.0.pre2 x86-mingw32)
> mysql2 (0.2.6 x86-mingw32)
> polyglot (0.3.1)
> populator (1.0.0)
> rack (1.2.2)
> rack-mount (0.6.14)
> rack-test (0.5.7)
> rails (3.0.5)
> railties (3.0.5)
> rake (0.8.7)
> rdiscount (1.6.8)
> rdoc (2.5.8)
> rest-client (1.6.1)
> rhodes (2.3.2)
> ruby-debug-base19 (0.11.24)
> ruby-debug-ide19 (0.4.12)
> ruby-debug19 (0.11.6)
> ruby_core_source (0.1.4)
> templater (1.0.0)
> thor (0.14.6)
> treetop (1.4.9)
> tzinfo (0.3.25)
>
> thanks for the reply
>
> On Apr 16, 4:18 pm, Luis Lavena  wrote:
>
>
>
>
>
>
>
> > On Apr 16, 11:58 am, cipher_neo  wrote:
>
> > > Hi guys,
>
> > > I have Rails 3 running on Windows 7 with Ruby 1.9.2
>
> > > Every now and again, my server crashes, and I see the following
> > > information in the windows event log:
>
> > > Faulting application name: ruby.exe, version: 1.9.2.180, time stamp:
> > > 0x4d5ee5ed
> > > Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180, time
> > > stamp: 0x4d5ee5ec
> > > Exception code: 0xc005
> > > Fault offset: 0x0011a00e
> > > Faulting process id: 0x1624
> > > Faulting application start time: 0x01cbfc46036ca1be
> > > Faulting application path: C:\Ruby192\bin\ruby.exe
> > > Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll
> > > Report Id: ae8872dc-6839-11e0-ae3f-904ce5fafcb7
>
> > > I have no clue what is causing this error, but it is a pain to try to
> > > get work done when my app keeps crashing.
>
> > Can you provide a list of the gems involved in your application?
>
> > That way we would be able to assist you better.
>
> > --
> > 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.



[Rails] Problem with new action 'validate'

2011-04-17 Thread Jose tomas R.
I've created a new action in my invitations controller named
validate and validation

controller/invitations_controller.rb

def validate
end

def validation
  @invitation = Invitation.find(params(:key))

  if @invitation != nil
  redirect_to new_client_path, :notice => 'Codigo Aceptado'
  else
  flash.now[:alert] = 'Ingrese un codigo valido'
  render :action => 'validate'
  end
   end

_validation_form.html.erb

<%= form_tag invitations_validate_path do %>
  
<%= label_tag :key %>
<%= text_field_tag :key %>
  
  
<%= submit_tag 'validate', :action => 'validation' %>
  
<% end %>

So when I enter a valid key I get redirected to create a user, but this
isn't working. the submit isnt doing anything, the :action => validation
is not working

config/routes.rb

resources :invitations do
  collection do
get :validate
get :validation
  end
end

-- 
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: why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag :defaults #abc%> is valid?

2011-04-17 Thread Frederick Cheung


On Apr 17, 7:43 pm, hanzhao  wrote:
> as the subject said.

I assume you mean <%= in the second case. The way that erb generates
ruby code from a template means that comments aren't supported - the
comment inside the <% tag ends up commenting other bits of the code
generated by erb.
The only form of comments that are safe is <%#

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.



Re: [Rails] why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag :defaults #abc%> is valid?

2011-04-17 Thread Michael Pavling
On 17 April 2011 19:43, hanzhao  wrote:
> why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag 
> :defaults #abc%> is valid?

What's invalid about it? I assume you get some sort of error
message... can you post that to enlighten us, please?

Personally, though, I find I get problems with Ruby parsing if I
comment in ERB tags after code, instead I tend to do this if I
desperately want to comment in a view:
<% code here %><%# comment here %>

-- 
You received 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: Adding composite index to pre-existent table

2011-04-17 Thread Frederick Cheung


On Apr 17, 8:19 pm, Federico  wrote:
> Hello everybody,
> I'm a newbie in RoR.
> In order to create a table I've created a migration with the 'rails
> generate model...' command.
> Now I would like to add a composite index over two columns of this
> table with another, new, migration.
> Is it possible?

of course

> I've read the documentation about the add_index transformation but I
> can't create the new migration from command line.
> I think I can edit the 'create table' migration file, but I would like
> to have a different migration (generated by 'rails' command).

rails generate migration do_blah will create a new migration called
do_blah

Fred
>
> Thanks in advance for your help,
>
> Federico

-- 
You received 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] Need experienced Ruby on Rails developers

2011-04-17 Thread Igor Alcantara
TopTal, LLC  __ (Palo Alto, CA, USA)

**Job Description**:

TopTal is selecting experienced Ruby on Rails programmers who are
interested in working remotely for our customers all over the world.
If you want to be part of our top engineers team, please send an email
to igor.alcant...@toptal.com

**Requirements**

* At lest 2 years of experience in Ruby on Rails
* Solid algorithm background
* Experience in any other programming language

**About the company**

We provide companies with the elite software engineers and developer
teams on a full- or part-time basis. All of our employees are
rigorously tested and curated by a team of highly-acclaimed engineers.
We specialize in providing the most talented developers and dynamic
engineering teams to start-ups, businesses, and organizations based on
their specific needs.

**Contact Info:**

* **Contact**: Igor Alcantara Recruiter
* **E-mail contact**: igor.alcant...@toptal.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] file_column undefined method relative_url_root

2011-04-17 Thread Tara Schultz
I just installed and started using the file_column plugin and am
getting the following error:

No Method Error
undefined method 'relative_url_root' for nil:NilClass

Extracted source (around line #5)
5: <%= image_tag url_for_file_column("fan", "image_url") %>

I'm running Rails 3.0.1.

Does anyone know what I need to do to fix this?

Thanks,
Tara

-- 
You received 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] why <% concat(csrf_meta_tag) #aa%> is invalid while <% javascript_include_tag :defaults #abc%> is valid?

2011-04-17 Thread hanzhao
as the subject said.

-- 
You received 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 composite index to pre-existent table

2011-04-17 Thread Federico
Hello everybody,
I'm a newbie in RoR.
In order to create a table I've created a migration with the 'rails
generate model...' command.
Now I would like to add a composite index over two columns of this
table with another, new, migration.
Is it possible?
I've read the documentation about the add_index transformation but I
can't create the new migration from command line.
I think I can edit the 'create table' migration file, but I would like
to have a different migration (generated by 'rails' command).

Thanks in advance for your help,

Federico

-- 
You received 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] Assigning admin invalidates the user

2011-04-17 Thread non useless
I am experiencing an issue as I am following the tutorial and
currently at the end of chapter 10. When I use toggle in the rails
console to flip the admin property of a user from false to true (I'm
trying to create an Admin user), I am successful in doing so, however
that user becomes invalid, when I try to log in to the application
with this user's credential I am getting an error that the credentials
are incorrect (even though they are) ... just from checking the logs
and the looking at the terminal, it seems the authenticity token is
either missing or incorrect... any ideas what I am doing wrong here? I
tried following the tutorial as close as possible, I doubt I missed
something, but its obviously possible..

Thank you and best regards!

-- 
You received 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] Integrating the fb_graph or koala gem with devise+mongoid+omniauth in rails 3

2011-04-17 Thread Andy S
I need Facebook API integration in my rails application, but I can't
figure out how to store the Facebook access token from Omniauth so
that it can be reused later by a Facebook API gem. The Facebook API
gems I am considering is fb_graph or koala (don't really care which),
but I am open to other solutions if there are better alternatives.

A question on Stackoverflow provides a solution which the questioner
(and I) were not able to get to work:
  
http://stackoverflow.com/questions/4010915/does-omniauth-provide-simple-hooks-to-the-facebook-graph-api

The base code I want to integrate fb_graph or koala into comes from
the official devise example page:
  https://github.com/plataformatec/devise/wiki/Example-Applications
The base I am using integrates devise+mongoid+omniauth:
   https://github.com/fertapric/rails3-mongoid-devise-omniauth.git

Any tips on how to integrate fb_graph or koala (or any other facebook
API connection) with this devise+mongoid+omniauth base would be
greatly appreciated.

Best,
Andy

-- 
You received 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] ERROR NameError: uninitialized constant ActiveSupport::Dependencies

2011-04-17 Thread doom spork
Hello all,

I keep getting the following error after visiting 127.0.0.1:3000 on a
fresh rails 3.0.6 install with ruby 1.9.2.  I have tried googling
solutions but most results are addressing the issue in rails 2 and
suggest adding 'require "threads"' to the boot.rb; this did not resolve
my issues.

Any suggestions on how to resolve this or where to start?

[2011-04-17 15:17:18] ERROR NameError: uninitialized constant
ActiveSupport::Dependencies
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:9:in
`initialize'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in
`new'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb:67:in
`use'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:190:in
`block in default_middleware_stack'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:189:in
`tap'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:189:in
`default_middleware_stack'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:161:in
`app'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:168:in
`call'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/application.rb:77:in
`method_missing'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/railties-3.0.3/lib/rails/rack/log_tailer.rb:14:in
`call'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/rack-1.2.2/lib/rack/content_length.rb:13:in
`call'
  
/Users/doom/.rvm/gems/ruby-1.9.2-p180@rails3/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in
`service'
  
/Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
`service'
  
/Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in
`run'
  
/Users/doom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in
`block in start_thread'

-- 
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: routes question rails 3.0 vs. rails 2.0

2011-04-17 Thread Phil Crissman
On Sun, Apr 17, 2011 at 12:59 PM, sol.manager  wrote:

>
>
> On Apr 16, 11:58 pm, Phil Crissman  wrote:
> > Phil
> >
> I tried this and it isn't working out.
> I have a job model. In the views/jobs/index.html.erb file I have the
> following at the top.
> Listing jobs
> <%= form_tag search_jobs_path, :method => :get do %>
> 
>  <%= text_field_tag :query, params[:query] %> <%= submit_tag
> "Search!" %>
> 
> <% end %>
>
> When i put in the route as below and try to pull up the jobs index, I
> now get a compile error. It does not like this line:
> <%= form_tag search_jobs_path, :method => :get do %>
>
> So what am I missing here?
>

What is the error?


>
> >
> > map.resources :jobs, :collection => {:search => :get}
> >
> > You can also still find the rails 2.3.x rails guides, which includes the
> > routing guide, from the index page ofhttp://guides.rubyonrails.org/
> >
> >
> >
> >
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: routes question rails 3.0 vs. rails 2.0

2011-04-17 Thread sol.manager


On Apr 16, 11:58 pm, Phil Crissman  wrote:
> Phil
>
I tried this and it isn't working out.
I have a job model. In the views/jobs/index.html.erb file I have the
following at the top.
Listing jobs
<%= form_tag search_jobs_path, :method => :get do %>

  <%= text_field_tag :query, params[:query] %> <%= submit_tag
"Search!" %>

<% end %>

When i put in the route as below and try to pull up the jobs index, I
now get a compile error. It does not like this line:
<%= form_tag search_jobs_path, :method => :get do %>

So what am I missing here?

>
> map.resources :jobs, :collection => {:search => :get}
>
> You can also still find the rails 2.3.x rails guides, which includes the
> routing guide, from the index page ofhttp://guides.rubyonrails.org/
>
>
>
>
>
> > --
> > You received 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] newbie: to_json only/except + association confusion

2011-04-17 Thread der_tom
hi,

i want to return to_json with 'only' and also filtered.so i tried
various ways, but none of them are really good:

A)#OK , but filter missing
  format.json  { render :json => @project.to_json(:only =>
[:title ], :include=> { :tasks => {:only=>[:id,:title] } }  )  }

B)#Not OK > filter does not work,
  format.json  { render :json => @project.to_json(:only =>
[:title ], :include=> { :tasks => {:only=>[:id,:title] },, :conditions
=> ['tasks.is_enabled = ?', 1] }  )  }

C) #Not OK > works, but cant use only/except
  format.json  { render :json => @project.to_json(:only =>
[:title ], :method=> get_enabled_tasks  )  }

def get_enabled_tasks
  tasks.where("is_enabled = ?", 1)


D)#OK, but json output not nice
  format.json  { render :json => @project.to_json(:only =>
[:title ], :method=> get_enabled_tasks  )  }

def get_enabled_tasks
  ActiveRecord::Base.connection.execute(sql)
>>
"project":{"title":"testprojecttitle","get_enabled_tasks":
[["tasktitle","user1","1.1.2011"]]}}



>> so, how can i get filtered associations in a to_json call so that i actually 
>> get goodlookin json?


thx


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



[Rails] Re: Ruby On Rails 3 and Webrick

2011-04-17 Thread kdwill
** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.6, 2.3.5, 2.2.2, 1.3.6)
actionpack (3.0.6, 2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activemodel (3.0.6)
activerecord (3.0.6, 2.3.5, 2.2.2, 1.15.6)
activeresource (3.0.6, 2.3.5, 2.2.2)
activesupport (3.0.6, 2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.12)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
erubis (2.6.6)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
i18n (0.5.0)
libxml-ruby (1.1.2)
mail (2.2.15)
mime-types (1.16)
mongrel (1.1.5)
mysql2 (0.2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
polyglot (0.3.1)
rack (1.2.2, 1.0.1)
rack-mount (0.6.14)
When I ran gem list, this is what I got.

rack-test (0.5.7)
rails (3.0.6, 2.3.5, 2.2.2, 1.2.6)
railties (3.0.6)
rake (0.8.7, 0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubygems-update (1.7.2)
rubynode (0.1.5)
sqlite3-ruby (1.2.4)
termios (0.9.4)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.26)
xmpp4r (0.4)


On Apr 17, 4:02 am, radhames brito  wrote:
> please post the result of typing
>
> gem list

-- 
You received 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: what is mean of Deployment?

2011-04-17 Thread Peter De Berdt


On 17 Apr 2011, at 17:04, amrit pal pathak wrote:


On Apr 17, 7:27 am, Chris Kottom  wrote:
Are you planning to continue using sqlite in the production  
environment?

 Most people don't, but it's not a problem to do so.

If not or if the default sqlite settings aren't right for you, then  
you'll
need to make some changes, but those will depend on the environment  
you're
deploying into.  But what those should be isn't a question the  
mailing list

can answer for you without more information.


  The production environment setting with sqllite are by
default .I want to use mysql for production too.So i changed the
production enviornment settings to
  production:
 adapter: mysql
 database: blog
 username: root
 password: 12345
 pool: 5
 timeout: 5000

  Is it enough??


If you're running Rails 3, you're better off using "mysql2" as the  
adapter and you have to make sure you include the mysql2 gem in your  
Gemfile too. Also, you might want to use a more secure password for  
MySQL on your production server ;-)



Best regards

Peter De Berdt

--
You received 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: what is mean of Deployment?

2011-04-17 Thread amrit pal pathak


On Apr 17, 7:27 am, Chris Kottom  wrote:
> Are you planning to continue using sqlite in the production environment?
>  Most people don't, but it's not a problem to do so.
>
> If not or if the default sqlite settings aren't right for you, then you'll
> need to make some changes, but those will depend on the environment you're
> deploying into.  But what those should be isn't a question the mailing list
> can answer for you without more information.

   The production environment setting with sqllite are by
default .I want to use mysql for production too.So i changed the
production enviornment settings to
   production:
  adapter: mysql
  database: blog
  username: root
  password: 12345
  pool: 5
  timeout: 5000

   Is it enough??

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: Error: uninitialized constant MysqlCompat::MysqlRes

2011-04-17 Thread Tianchen J.
After wrestling with this problem for several days I finally got it
nailed. 2 things that I have done that made it work:

   1. sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri
mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
   2. export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"


I'm on Snow Leopard, and have only 1 MySQL (x86_64) 5.5, and 1 ruby
(prepackaged with Snow Leopard) installed.

-- 
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] Basic crud pages for STI models

2011-04-17 Thread Perry Smith
If you have a model that is using single table inheritance, the simple
new, create, edit, and update methods and views might not do what you
want them to do.  I have an ActiveRecord::Base with just a name and a
type so I can define a Team (type) of "account" and a Dept of Education.
But suppose I misspell Education and I want to edit it.  What happens is
the edit method finds the record and makes it into a Dept (type or
class).  This confuses the form_for(@name) into producing URLs for Dept
which in my case isn't want I wanted.  I wanted to edit the entry as a
name.  (In my case, I don't have URLs and controllers for Team or Dept,
etc.)

The solution was to us becomes(klass) so the edit method becomes:

  def edit
@name = Name.find(params[:id]).becomes(Name)
  end

I did that same thing after all of the calls to find **in this case**.
There are probably 99% of the time that you want find to change the
instance into the proper class but if you don't, this is a simple way to
cast it back to the parent class.

-- 
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: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
Are you planning to continue using sqlite in the production environment?
 Most people don't, but it's not a problem to do so.

If not or if the default sqlite settings aren't right for you, then you'll
need to make some changes, but those will depend on the environment you're
deploying into.  But what those should be isn't a question the mailing list
can answer for you without more information.

On Sun, Apr 17, 2011 at 11:37 AM, amrit pal pathak <
amritpalpath...@gmail.com> wrote:

>
>
> On Apr 17, 4:06 am, Chris Kottom  wrote:
> > In a strict operational sense, the term means installation and
> > configuration/activation of software on any environment under management,
> so
> > it could be meant as production, staging, integration testing, etc.  In
> the
> > Rails world where development and testing are most often virtual
> > environments coexisting on the developer's workstation, this will only be
> > the production environment for most cases.
> I am running the application in development enviornment.I want
> to run it under now production one.So what changes i have to make in
> database.yml file
>
> The content of this file as are
>
>  # SQLite version 3.x
> #   gem install sqlite3-ruby (not necessary on OS X Leopard)
> development:
>  adapter: mysql
>  database: amritpal
>  username: root
>  password: 12345
>  pool: 5
>  timeout: 5000
>
> # Warning: The database defined as "test" will be erased and
> # re-generated from your development database when you run "rake".
> # Do not set this db to the same as development or production.
> test:
>  adapter: sqlite3
>  database: db/test.sqlite3
>  pool: 5
>  timeout: 5000
>
> production:
>  adapter: sqlite3
>  database: db/production.sqlite3
>  pool: 5
>  timeout: 5000
>
> 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.



Re: [Rails] Re: Ruby On Rails 3 and Webrick

2011-04-17 Thread radhames brito
please post the result of typing

gem list

-- 
You received 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 3 and Webrick

2011-04-17 Thread kdwill
Thanks for your help.

Yes. I doubled checked through the command line and it lists that it's
there.

I'm lost.

On Apr 17, 2:50 am, Fernando Perez  wrote:
> > /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle:
> > dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
> > mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
> > (LoadError)
> >   Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
> > mysql2.bundle
> >   Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/
> > lib/mysql2/mysql2.bundle
>
> Have you installed the mysql server and mysql rubygem?
>
> --http://digiprof.tvhttp://suivauto.com
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



Re: [Rails] Re: No route matches "/home/index" with {:method=>:get}

2011-04-17 Thread Jatin kumar
On Sun, Apr 17, 2011 at 9:28 AM, amrit pal pathak  wrote:

>
>
> On Apr 17, 2:59 am, Jatin kumar  wrote:
> > On Sun, Apr 17, 2011 at 6:46 AM, amrit pal pathak <
> amritpalpath...@gmail.com
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > wrote:
> > > I followed a tutorial to learn ruby on rails at
> > >http://guides.rubyonrails.org/v2.3.8/getting_started.html
> > > After creating a view and controller as  "script/generate controller
> > > home index" and then i changed the contents of app/view/home/
> > > index.html.erb file according to tutorial into one line as
> > > Hello, Rails!
> >
> > > Now i started the server as script/
> > > server(successfully started) and when i navigate to localhost:3000/
> > > home/index, i got a error message which says
> >
> > > ROUTING ERROR
> > > No route matches "/home/index" with {:method=>:get}
> >
> > > Remove the /public/index.html file in your app directory.
> >
> > Check to see if you have a route for root in your routes.rb file.
> > If not, make it
> > *map.root :controller => "home"*
> > If you still have problems, post the contents of your routes file.
>I added the  *map.root :controller => "home"* at the bottom of
> router.rb file and it worked.so i could accessed now "localhost:3000/
> home/index
>
> Please  explain how it (*map.root :controller => "home"*)  is
> working (means which part calls to which).
>
> Go through the rails getting started guides if you run into issues like
these again. Google it. The first link will get you there.
As far as the above is concerned, map.root tells the route for the root i.e.
localhost:3000 in development or www.domain.com in production.

> 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] Re: Ruby On Rails 3 and Webrick

2011-04-17 Thread Fernando Perez
> /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle:
> dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
> mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
> (LoadError)
>   Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
> mysql2.bundle
>   Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/
> lib/mysql2/mysql2.bundle

Have you installed the mysql server and mysql rubygem?


--
http://digiprof.tv
http://suivauto.com

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: what is mean of Deployment?

2011-04-17 Thread amrit pal pathak


On Apr 17, 4:06 am, Chris Kottom  wrote:
> In a strict operational sense, the term means installation and
> configuration/activation of software on any environment under management, so
> it could be meant as production, staging, integration testing, etc.  In the
> Rails world where development and testing are most often virtual
> environments coexisting on the developer's workstation, this will only be
> the production environment for most cases.
I am running the application in development enviornment.I want
to run it under now production one.So what changes i have to make in
database.yml file

 The content of this file as are

 # SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: mysql
  database: amritpal
  username: root
  password: 12345
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

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: No route matches "/home/index" with {:method=>:get}

2011-04-17 Thread amrit pal pathak


On Apr 17, 4:01 am, Chris Kottom  wrote:
> Also verify that you are _actually_ using Rails 2.3.8.  Very basic check, I
> know, but routing syntax is different in Rails 3, and I don't believe older
> syntax is supported.

  I am running rails 2.3.5 and this format worked for me.

Thanks

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



[Rails] Re: No route matches "/home/index" with {:method=>:get}

2011-04-17 Thread amrit pal pathak


On Apr 17, 2:59 am, Jatin kumar  wrote:
> On Sun, Apr 17, 2011 at 6:46 AM, amrit pal pathak 
>
>
>
>
>
>
>
>
> > wrote:
> > I followed a tutorial to learn ruby on rails at
> >http://guides.rubyonrails.org/v2.3.8/getting_started.html
> > After creating a view and controller as  "script/generate controller
> > home index" and then i changed the contents of app/view/home/
> > index.html.erb file according to tutorial into one line as
> >     Hello, Rails!
>
> >                     Now i started the server as script/
> > server(successfully started) and when i navigate to localhost:3000/
> > home/index, i got a error message which says
>
> > ROUTING ERROR
> > No route matches "/home/index" with {:method=>:get}
>
> > Remove the /public/index.html file in your app directory.
>
> Check to see if you have a route for root in your routes.rb file.
> If not, make it
> *map.root :controller => "home"*
> If you still have problems, post the contents of your routes file.
   I added the  *map.root :controller => "home"* at the bottom of
router.rb file and it worked.so i could accessed now "localhost:3000/
home/index

 Please  explain how it (*map.root :controller => "home"*)  is
working (means which part calls to which).

Thanks

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



Re: [Rails] Re: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
In a strict operational sense, the term means installation and
configuration/activation of software on any environment under management, so
it could be meant as production, staging, integration testing, etc.  In the
Rails world where development and testing are most often virtual
environments coexisting on the developer's workstation, this will only be
the production environment for most cases.

On Sun, Apr 17, 2011 at 9:48 AM, Colin Law  wrote:

> On 17 April 2011 07:08, amrit pal pathak 
> wrote:
> >
> >
> > On Apr 16, 11:40 am, Colin Law  wrote:
> >> On 16 April 2011 16:32, amritpal pathak 
> wrote:
> >>
> >> > what is meaning of deploy a ruby on rails application?i am new to RoR.
> >> > please somebody explain it
> >>
> >> Deployment is the process of putting the application on a production
> >> server for use by real users.
> >   Means enabling the production server from the database.yml file
>
> It is generally not only that as the machine that will be running the
> app in production is generally not the same one used for development.
> So deployment is the whole operation of getting it up and running on
> the production machine, which is often a public webserver rather than
> a desktop machine so the software environment is often significantly
> different.
>
> 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] No route matches "/home/index" with {:method=>:get}

2011-04-17 Thread Chris Kottom
Also verify that you are _actually_ using Rails 2.3.8.  Very basic check, I
know, but routing syntax is different in Rails 3, and I don't believe older
syntax is supported.

On Sun, Apr 17, 2011 at 8:59 AM, Jatin kumar wrote:

>
>
> On Sun, Apr 17, 2011 at 6:46 AM, amrit pal pathak <
> amritpalpath...@gmail.com> wrote:
>
>> I followed a tutorial to learn ruby on rails at
>> http://guides.rubyonrails.org/v2.3.8/getting_started.html
>> After creating a view and controller as  "script/generate controller
>> home index" and then i changed the contents of app/view/home/
>> index.html.erb file according to tutorial into one line as
>> Hello, Rails!
>>
>> Now i started the server as script/
>> server(successfully started) and when i navigate to localhost:3000/
>> home/index, i got a error message which says
>>
>> ROUTING ERROR
>> No route matches "/home/index" with {:method=>:get}
>>
>> Remove the /public/index.html file in your app directory.
> Check to see if you have a route for root in your routes.rb file.
> If not, make it
> *map.root :controller => "home"*
> If you still have problems, post the contents of your routes file.
>
>> Please someone help to resolve.
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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



Re: [Rails] Re: what is mean of Deployment?

2011-04-17 Thread Colin Law
On 17 April 2011 07:08, amrit pal pathak  wrote:
>
>
> On Apr 16, 11:40 am, Colin Law  wrote:
>> On 16 April 2011 16:32, amritpal pathak  wrote:
>>
>> > what is meaning of deploy a ruby on rails application?i am new to RoR.
>> > please somebody explain it
>>
>> Deployment is the process of putting the application on a production
>> server for use by real users.
>   Means enabling the production server from the database.yml file

It is generally not only that as the machine that will be running the
app in production is generally not the same one used for development.
So deployment is the whole operation of getting it up and running on
the production machine, which is often a public webserver rather than
a desktop machine so the software environment is often significantly
different.

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: belongs_to cache

2011-04-17 Thread Frederick Cheung


On Apr 15, 7:07 pm, koulikoff  wrote:
> Hello, All!
>
> I've met the strange behavior and would like to ask the community if
> this is normal?
>
> class TradingAccount < ActiveRecord::Base
>   belongs_to :trading_account_type
> end
>
> $ rails c
> Loading development environment (Rails 3.0.5)
> irb(main):001:0> TradingAccountType.all.map(&:id)
> => [1, 2]
> irb(main):002:0> ta = TradingAccount.find 6
> => # 2, ...>
> irb(main):003:0> ta.trading_account_type.id
> => 2
> irb(main):004:0> ta.trading_account_type_id = 1
> => 1
> irb(main):005:0> ta.trading_account_type.id
> => 2
>
> It means that after the trading_account_type_id change the object is
> not cleared and remains in the cache.

I vaguely remember a ticket on the rails bug tracker about this. I
don't remember what the resolution was.

Fred

> I think that the change of trading_account_type_id should clear the
> cache and the following call to #trading_account_type should load from
> the database the one with id == 1
>
> I've met this problem while establishing the validation:
>
>   validates_uniqueness_of :trading_account_type_id, :scope
> => :client_id,
>     :if => Proc.new { |ta| ta.trading_account_type.singleton rescue
> nil }
>
> that has to be rewritten as:
>
>   validates_uniqueness_of :trading_account_type_id, :scope
> => :client_id,
>     :if => Proc.new { |ta|
>       tat = ta.trading_account_type
>       unless !tat || tat.id == ta.trading_account_type_id
>         tat = TradingAccountType.find ta.trading_account_type_id
> rescue nil
>       end
>       tat && tat.singleton?
>     }
>
> What would you say?

-- 
You received 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] Ruby On Rails 3 and Webrick

2011-04-17 Thread kdwill
Hi,

Thanks for taking a look at this.

I started a beginner's tutorial on RoR through lynda.com. I followed
the instructions to the letter. Everything was working so far until I
got to accessing Webrick. When I typed in "rails server" to begin
work, I got this error message below.

/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle:
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
(LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/
mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/
lib/mysql2/mysql2.bundle

from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/
runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in
`require'
from /Users/macuser/Sites/simplecms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:
28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:
28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:
27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:
27
from script/rails:6:in `require'
from script/rails:6

I'm using a

 - iMac
 - Ruby 1.87
 - Gem 1.7.2

I have been exposed to very little Rails and looking to learn how to
fix this. Your help would be greatly appreciated.

Thanks in advance for your attention and help if possible.

-- 
You received 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: calling methods from one object in another?

2011-04-17 Thread Frederick Cheung


On Apr 17, 6:26 am, Nathan Domier  wrote:
> I realize the title probably doesn't make much sense, but that was the
> best short description I could come up with.
>
> Anyway, I have users and pages in my site, and was using the following
> code in the users controller, which works fine:
>
> 
>   def show
>     @user = User.find(params[:id])
>     @title = @user.Fname + " " + @user.Lname
>   en
> 
>
> However, if I go to the pages controller, and use the following code, I
> get "Couldn't find user without an id" for an error.
>
> 
>   def home
>     @title = "Home"
>     @user = User.find(params[:id])
>   end
> 
>
> Using User.find(1) works just fine instead of User.find(params[:id])
>
> I feel like I'm probably just restricting something to Users only
> somehow, but can't figure it out.  Seems like it would be obvious to
> someone more experienced, (I hope?)

Your show action will usually be supplied with a :id parameter (since
show usually means show me this particular user) via the url (eg /
users/123) or query parameters.
On the other hand it sounds like when you link to your home action in
the pages controller you're not supplying an id parameter, and so
params[:id] is nil, so User.find(params[:id]) can't work.
Which user did you want to show?

Fred
>
> --
> Posted viahttp://www.ruby-forum.com/.

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