Ruby on Rails Friday, May 31, 2013

sometimes we need to truncate a long text more smart. 
eg:

The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic that is specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the Active Model module. You can read more about Active Record in its README.

to

The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic that is specific to your application.

I create a method content_truncate to implementation my requirement. But it is so immature for merge into activesupport

So welcome advices

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1ceeaa22-b640-4e6a-9e94-fd3f33981fbc%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi Rick,
thanks! I tried carrying out those instructions: heres what i got -
mwr@mwr-Ubuntu:/home$ which rails
/home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails


mwr@mwr-Ubuntu:/home$ which
/home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails
/home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails

I suppose im having trouble with step 2 of your directions. However its
nice to have a kind of explanation of whats going on. Again, excuse my
illiteracy on this, but it look like maybe i do have rails installed in
my home directory?

**just discovered by accident I can do this:
mwr@mwr-Ubuntu:/home$ which
/home/mwr/.rvm.gems/ruby-1.9.3-p429/bin/rails
mwr@mwr-Ubuntu:/home$ wc -l 'which rails'
wc: which rails: No such file or directory
mwr@mwr-Ubuntu:/home$ cd ..
mwr@mwr-Ubuntu:/$ which rails
/home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails
mwr@mwr-Ubuntu:/$ which /home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails
/home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails
mwr@mwr-Ubuntu:/$ rails new path/here
create
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:247:in
`mkdir': Permission denied - /path (Errno::EACCES)
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:247:in
`fu_mkdir'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:221:in
`block (2 levels) in mkdir_p'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:219:in
`reverse_each'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:219:in
`block in mkdir_p'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:205:in
`each'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/fileutils.rb:205:in
`mkdir_p'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:51:in
`block in invoke!'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:117:in
`call'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:117:in
`invoke_with_conflict_check'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:50:in
`invoke!'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions.rb:95:in
`action'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:15:in
`empty_directory'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/generators/app_base.rb:103:in
`create_root'
from (eval):1:in `create_root'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/command.rb:27:in
`run'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/invocation.rb:120:in
`invoke_command'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
`block in invoke_all'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
`each'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
`map'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/invocation.rb:127:in
`invoke_all'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/group.rb:233:in
`dispatch'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/thor-0.18.1/lib/thor/base.rb:439:in
`start'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/commands/application.rb:38:in
`<top (required)>'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/lib/rails/cli.rb:15:in
`<top (required)>'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from
/home/mwr/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from
/home/mwr/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.13/bin/rails:7:in
`<top (required)>'
from /home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails:19:in `load'
from /home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/rails:19:in `<main>'
from /home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in
`eval'
from /home/mwr/.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in
`<main>'
mwr@mwr-Ubuntu:/$ ls
bin dev initrd.img lib64 mnt root selinux tmp
vmlinuz
boot etc initrd.img.old lost+found opt run srv usr
vmlinuz.old
cdrom home lib media proc sbin sys var

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/75aa0fbfb736ab47d1796611463274a4%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hassan Schroeder wrote in post #1110852:
> On Fri, May 31, 2013 at 4:49 PM, mark ronay <lists@ruby-forum.com>
> wrote:
>> ruby -v gives ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
>> rails -v gives Rails 3.2.13
>> gem -v gives 1.8.25
>
> Those seem reasonable, though the result doesn't :-/
>
> Given that you're just starting, I'd be inclined to totally remove rvm
> (rvm implode), make sure that your old system ruby has no trace
> of rails or related gems, and then reinstall rvm, 1.9.3, and rails.
>
> Slash and burn, but ... with a quick look at the source, I don't see
> how you're getting that message...
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan


Im starting to lean that way, thanks again.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/551a239e44ce7c2a10fc8f78921b9965%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

>
> P.S. None of this code has been tested. Just wrote it by memory.

Thank you. I get it. It worked well with a couple of small tweaks.
...wish I could do that from memory :-)

Thanks,
Dave

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6a2060f9a68d580f25105951cbfbf98b%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

for what it's worth, the error message is generated in the file: gems/railties-3.2.13/lib/rails/commands.rb

On Friday, May 31, 2013 9:09:16 PM UTC-4, Rick wrote:

There are (at least) two executable ruby scripts named "rails".  The first is found in your typical search path and should be the one that gets called when you type "rails new my_app".  The second is found, after creating your new application "my_app", in the directory "my_app/script" (rails version 3) or "my_app/bin" (rails version 4).

These ruby scripts named "rails" are not the same and, if you call the second with the "new my_app" arguments, "rails" will assume you are running inside an existing application and hurl error chunks at you.

Do this

1) type the command "which rails" and you will see the full path to what your current shell assumes to be the true rails command. 

i.e. on my system
555 > which rails
/opt/local/bin/rails
 556 >

2) type the command "wc -l `which rails`" -- if you can't figure out the quoting just use the result of step 1.  i.e. on my system "which /opt/local/bin/rails"

you should see a result that is somewhere around 23 (lines) but i'm thinking you'll see 6.  the first number is the correct system wide rails script that will let you create a new app, the second number is the rails script that is placed into "my_app/script" (or "my_app/bin") and will be used when you "rails generate ..." or other such inside your new application directory structure.

just to beat this horse to death, here's what i get when, in my home directory, i call an application (6 line) rails with new...

561 > binky/script/rails new boffo
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
 562 >

look familiar?

On Friday, May 31, 2013 6:28:06 PM UTC-4, Ruby-Forum.com User wrote:
Im a new user - I just installed rails, following directions here:
http://rubyonrails.org/download
however, when it came time to make a rails new path/etc/etc I get this
message:
Can't initialize a new Rails application within the directory of
another, please change to a non-Rails directory first.
The only complication during the download was that I had to upgrade from
version 1.8.6 to 1.9.3, which I did after installing rails. Otherwise
Ive done nothing but follow the very simple directions.
I found this very helpful thread http://www.ruby-forum.com/topic/1780147
but when the output of ls -l shows just my usual directories. Any help
is greatly appreciated.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2163d288-fef7-4b1d-a34c-29e5169c6615%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

There are (at least) two executable ruby scripts named "rails".  The first is found in your typical search path and should be the one that gets called when you type "rails new my_app".  The second is found, after creating your new application "my_app", in the directory "my_app/script" (rails version 3) or "my_app/bin" (rails version 4).

These ruby scripts named "rails" are not the same and, if you call the second with the "new my_app" arguments, "rails" will assume you are running inside an existing application and hurl error chunks at you.

Do this

1) type the command "which rails" and you will see the full path to what your current shell assumes to be the true rails command. 

i.e. on my system
555 > which rails
/opt/local/bin/rails
 556 >

2) type the command "wc -l `which rails`" -- if you can't figure out the quoting just use the result of step 1.  i.e. on my system "which /opt/local/bin/rails"

you should see a result that is somewhere around 23 (lines) but i'm thinking you'll see 6.  the first number is the correct system wide rails script that will let you create a new app, the second number is the rails script that is placed into "my_app/script" (or "my_app/bin") and will be used when you "rails generate ..." or other such inside your new application directory structure.

just to beat this horse to death, here's what i get when, in my home directory, i call an application (6 line) rails with new...

561 > binky/script/rails new boffo
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
 562 >

look familiar?

On Friday, May 31, 2013 6:28:06 PM UTC-4, Ruby-Forum.com User wrote:

Im a new user - I just installed rails, following directions here:
http://rubyonrails.org/download
however, when it came time to make a rails new path/etc/etc I get this
message:
Can't initialize a new Rails application within the directory of
another, please change to a non-Rails directory first.
The only complication during the download was that I had to upgrade from
version 1.8.6 to 1.9.3, which I did after installing rails. Otherwise
Ive done nothing but follow the very simple directions.
I found this very helpful thread http://www.ruby-forum.com/topic/1780147
but when the output of ls -l shows just my usual directories. Any help
is greatly appreciated.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a4accc33-e096-45e0-a966-6a125b6e9939%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Fri, May 31, 2013 at 4:49 PM, mark ronay <lists@ruby-forum.com> wrote:
> ruby -v gives ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
> rails -v gives Rails 3.2.13
> gem -v gives 1.8.25

Those seem reasonable, though the result doesn't :-/

Given that you're just starting, I'd be inclined to totally remove rvm
(rvm implode), make sure that your old system ruby has no trace
of rails or related gems, and then reinstall rvm, 1.9.3, and rails.

Slash and burn, but ... with a quick look at the source, I don't see
how you're getting that message...

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCGLUsG_qUVvsEnjKCLG3Av5AjnROcsR%2BQs8bjKRKzTnw%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

What is the command you are using to create a new rails app?  Just to be sure, type the command into a terminal window and copy / paste the command you typed and the output from rails.


On Friday, May 31, 2013 7:49:14 PM UTC-4, Ruby-Forum.com User wrote:

ruby -v gives ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
rails -v gives Rails 3.2.13
gem -v gives 1.8.25

Im running ubuntu. I had ruby 1.8.6. I installed gem but it gave an
error when I was trying to get rails through gem, bc i had the old
version of ruby. I got rvm, updated to 1.9.3 and then reinstalled rails.

It does indeed give the same " Can't initialize a new Rails application
within the directory of another, please change to a non-Rails directory
first" when Im in an empty directory I made from home.

Thank you for your help by the way.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1e479855-b494-4fbe-935a-a6a7f16762a7%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

ruby -v gives ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
rails -v gives Rails 3.2.13
gem -v gives 1.8.25

Im running ubuntu. I had ruby 1.8.6. I installed gem but it gave an
error when I was trying to get rails through gem, bc i had the old
version of ruby. I got rvm, updated to 1.9.3 and then reinstalled rails.

It does indeed give the same " Can't initialize a new Rails application
within the directory of another, please change to a non-Rails directory
first" when Im in an empty directory I made from home.

Thank you for your help by the way.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/75637d29a81d13ec45466de04c06d152%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Fri, May 31, 2013 at 3:54 PM, mark ronay <lists@ruby-forum.com> wrote:
> exact same thing

In an empty directory? Then I'd say you have serious problems.

> The only complication during the download was that I had to
> upgrade from version 1.8.6 to 1.9.3, which I did after installing rails.

Wait, *after* installing Rails? That, in retrospect, sounds bad. What
OS/platform are you on?

And what do you get from the following commands:
ruby -v
rails -v
gem -v

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yD8Op%2BsGEQEJ%2BEdCz%3Dcx6zXP94xJzK_Xwn8uXQiA1G9sg%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

exact same thing

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ac44a9a82985e325185d020582ee5035%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Fri, May 31, 2013 at 3:28 PM, mark ronay <lists@ruby-forum.com> wrote:
> Im a new user - I just installed rails, following directions here:
> http://rubyonrails.org/download
> however, when it came time to make a rails new path/etc/etc I get this
> message:
> Can't initialize a new Rails application within the directory of
> another, please change to a non-Rails directory first.

So, what happens if you make a new directory, cd to it, and run your
`rails new blah` command?

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCdg-RxmqKr-LVj_BxAfDCaN8tEpR%2BRzi5oQkYrq95Qag%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Im a new user - I just installed rails, following directions here:
http://rubyonrails.org/download
however, when it came time to make a rails new path/etc/etc I get this
message:
Can't initialize a new Rails application within the directory of
another, please change to a non-Rails directory first.
The only complication during the download was that I had to upgrade from
version 1.8.6 to 1.9.3, which I did after installing rails. Otherwise
Ive done nothing but follow the very simple directions.
I found this very helpful thread http://www.ruby-forum.com/topic/1780147
but when the output of ls -l shows just my usual directories. Any help
is greatly appreciated.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/423d62f3592cef90d328e7442490793e%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 31 May 2013 18:36, Paul Bergstrom <lists@ruby-forum.com> wrote:
> If I have a file in view /test called index.js.erb and in it a simple
> alert("hello") shouldn't that run when I go to /test/index? It doesn't.

I think you will have to give us a bit more detail on exactly what you
have done. First have a look at the Rails Guide on Debugging to see
ways that you can debug your code to work out what is going wrong.

Colin

>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/25cb5ad9a7367a51c4821cadd1554cef%40ruby-forum.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuSMYKfVk6uDPpPBRvPfpPmxGu9jYcKQCxipXmkEGDF1w%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I get an array back in json. That is loaded but without styling.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/add0e6ea9b0aa3138cfe66786df1413e%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I have has_many through for User, Prog and Enrollment models. Idea is that User is able to add Prog to his profile and Prog is able to remove association from Enrollment or update status attribute.

  def create
    @prog = Prog.find(params[:id])
    Enrollment.create(user_id: current_user.id, prog_id: @prog.id, status: "pending")
    redirect_to @prog, notice: "Programme is added"
  end

   def accept
     @enrollment = Enrollment.find_by_user_id(params[:id])
     @enrollment.status = "accepted"
     @enrollment.save!
    redirect_to progs_path, notice: "added"
  end

<% @prog.users.each do |user| %>
<%= link_to "#{user.email} accept", controller: "/enrollments", action: "accept", method: "post", id: user.id, id: @prog %>/
<% end %>

I understand that accept method is lack of @prog to find right column in Enrollment table, but I don't undestand how do I pass this id?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed52ec29-c422-4d70-9fdf-bb10a4103578%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Benjamin Iandavid Rodriguez wrote in post #1110828:
> For what you say.
>
> After you get the JSON response the partial is already processed so you
> just need to update the correct div with the correct info.
>
> Use jQuery's append or html properties to update your divs.
>
>
> 2013/5/31 Paul Bergstrom <lists@ruby-forum.com>

I haven't loaded the partial from start. Sorry but I don't know how to
update the div.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/21b4dda042298df3a784c58ae2b6bc56%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

For what you say.

After you get the JSON response the partial is already processed so you just need to update the correct div with the correct info.

Use jQuery's append or html properties to update your divs.


2013/5/31 Paul Bergstrom <lists@ruby-forum.com>
I'm able to get json data back after an ajax call and into a div. But
how do I get it into html, styled format?

How about getting it to a partial? How do I do that in coffeescript?

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/27f55d9596c7977ad612f3433528d425%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHRDpXpvysMbmCZO%3DMX4%3DZAqf-K-Ve4FAot6RX_4f%2BN5L0V3EQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I'm able to get json data back after an ajax call and into a div. But
how do I get it into html, styled format?

How about getting it to a partial? How do I do that in coffeescript?

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/27f55d9596c7977ad612f3433528d425%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails



On Thursday, 30 May 2013 05:31:54 UTC-7, Ruby-Forum.com User wrote:

I tried to update a rails site going from 2.3.5 to 2.3.15, which failed.
I had a backup of the site which I restored, but the site still will not
start. It errors with:

undefined method `name' for "actionmailer":String

0 /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb
268 in ==' 1 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 217
in===' 2 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 217 in
matching_specs' 3 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
36 infind_all' 4 /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb
412 in each' 5 /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb 411
ineach' 6 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 216 in
find_all' 7 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 216
inmatching_specs' 8 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb
238 in to_specs' 9 /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb
256 into_spec' 10 /usr/lib/ruby/site_ruby/1.8/rubygems.rb 1231 in gem'
11 /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb
73 inadd_load_paths' 12
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 in
add_gem_load_paths' 13
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 ineach'
14 /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 in
add_gem_load_paths' 15
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 132
inprocess' 16 /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb
113 in send' 17
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 113 inrun' 18
/var/www/lloyds/config/environment.rb 9
19 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 55 in
gem_original_require' 20
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 55 inrequire'

My gem list

* LOCAL GEMS *

actionmailer (2.3.5, 2.3.2)
actionpack (2.3.5, 2.3.2)
activerecord (2.3.5, 2.3.2)
activeresource (2.3.5, 2.3.2)
activesupport (2.3.5, 2.3.2)
authlogic (2.1.3)
exception_notification (1.0.20090728)
fastthread (1.0.7)
mysql (2.8.1)
paperclip (2.3.1.1)
passenger (2.2.9)
rack (1.1.6, 1.0.1)
rails (2.3.5, 2.3.2)
rake (0.8.7)
rubygems-update (1.8.25)


The older versions of 2.3.x get very cranky indeed with modern versions of Rubygems. Try rolling back to something of a more appropriate vintage (I've got an old 2.3 app that uses rubygems-update 1.4.2 successfully).

--Matt Jones
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5918c746-b3a3-4824-b7ab-0fec076f967d%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi.


I created an app to illustrate my problem: https://github.com/Dagnan/rails_inverse_of

I have a model with a belongs_to, and the other with a has_one. So far so good.
When I configure the option inverse_of on both model and I perform a simple #save on the main object, it is actually saved two times (once saved and then updated).

Is it an expected behavior?

A way to avoid this problem would be not to use inverse_of, or to have "autovalidate: false" in the second model (Recurrence in my example) for the has_one association.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fd418f1a-3c1d-48ec-9f1c-daad47331001%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

If I have a file in view /test called index.js.erb and in it a simple
alert("hello") shouldn't that run when I go to /test/index? It doesn't.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/25cb5ad9a7367a51c4821cadd1554cef%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I just don't want to go through the same thing I did with all my Rails 2.3 apps on 1.8.7. It was a real pain to bring them up to Rails 3 and 1.9.x since I wasn't using Bundler on 2.3.

Walter

On May 31, 2013, at 1:09 PM, John Davalos wrote:

> I'm running 2.0 on my laptop along with rails 3.2 apps without any issues. Is there something specific you're concerned with? This should be particularly easy if you're running rvm or rbenv. you can install ruby 2.0 then when you go to install the rails gem you can just set the version of rails you want to install.
>
> gem install rails -v=3.2
>
>
>
>
> On Fri, May 31, 2013 at 5:40 AM, Walter Lee Davis <waltd@wdstudio.com> wrote:
> Can anyone recommend one way or the other this particular combination?
>
> I'm not ready to jump on the Rails 4 bandwagon, I have a lot of sites to get up to 3.2 first, just as a jumping-off point for their eventual migration to 4. I just read that 1.9.3 is only going to be maintained until 2014, which in the time-scale of some of my projects is just moments away.
>
> Trying to plan, any thoughts?
>
> Walter
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1319F198-0D5A-43A2-B8BA-9E6A0607A62A%40wdstudio.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAE%2BzMv8-_4fe9FdQtYVYPp0h56bXeubq_oFa_bYxJm0cDA-TcA%40mail.gmail.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2CFA80EF-E4E3-4719-8AFA-CA61C35AF239%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I'm running 2.0 on my laptop along with rails 3.2 apps without any issues. Is there something specific you're concerned with?  This should be particularly easy if you're running rvm or rbenv. you can install ruby 2.0 then when you go to install the rails gem you can just set the version of rails you want to install.

 gem install rails -v=3.2




On Fri, May 31, 2013 at 5:40 AM, Walter Lee Davis <waltd@wdstudio.com> wrote:
Can anyone recommend one way or the other this particular combination?

I'm not ready to jump on the Rails 4 bandwagon, I have a lot of sites to get up to 3.2 first, just as a jumping-off point for their eventual migration to 4. I just read that 1.9.3 is only going to be maintained until 2014, which in the time-scale of some of my projects is just moments away.

Trying to plan, any thoughts?

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1319F198-0D5A-43A2-B8BA-9E6A0607A62A%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAE%2BzMv8-_4fe9FdQtYVYPp0h56bXeubq_oFa_bYxJm0cDA-TcA%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

When u say u need a workflow diagram, I assume u are talking about the data flow or communication sequence


So to help u solve this problem, one hint is 
u have to illustrate how the components talks to each other when there is a http request coming in

For example, in the case of "user wants to create a post message"
U have to write down
What data is passed from the browser to these group if components ?
Which one of these components receive the http request first ?
What information is passed from one component to another ?

Hope this help.



On Friday, May 31, 2013, Hassan Schroeder wrote:
On Fri, May 31, 2013 at 6:02 AM, Seth F. <lists@ruby-forum.com> wrote:
> I have a basic knowledge of all of them, but the main reason of this
> task is to try and understand the logic of updating and maintaining the
> system. Basically, I'm trying to complete a puzzle of how these work
> together / in what way each of them reference eachother.

Maybe you should start by defining the two primary end points --
start, finish -- of the flow, and see how those pieces fit into that.

Also, it might be good to demonstrate that "basic knowledge" by
writing a 1-sentence description of the primary role of each of the
pieces you listed  :-)

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAN9iPuTzH2jCb16M3C2P_hQaAR2sqb8rXxBrom1_BTNw%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAMGzbWGC3rOMnaDDKMyeefakCzhmzGFoUAUam1qO-ASg-%3DD2UQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Dave Castellano wrote in post #1110796:
> Hi,
>
> I'm learning rails and have run into what for me is a difficult problem.
> I have the following associations with a galleries_pictures and a
> pictures_questions join table:
>
> class Picture < ActiveRecord::Base
> has_and_belongs_to_many :questions
> has_and_belongs_to_many :galleries
>
> class Question < ActiveRecord::Base
> has_and_belongs_to_many :pictures
>
> class Gallery < ActiveRecord::Base
> has_and_belongs_to_many :pictures
>
> In the edit question view, a question and its associated picture(s) can
> be edited. My problem is, I cannot figure out how to delete the picture
> in the question and at the same time not delete it from the gallery ie
> delete the pictures_questions association but not the
> galleries_pictures association.
>
> The action called from the view deletes the row in both join tables:
> def destroy
> @picture = Picture.find(params[:id])
> @picture.destroy
>
> Thanks!

Here you are destroying the picture object so naturally Rails will
manage the associations automatically. What you want to do instead is
to delete the association not the actual picture object.

There are a couple of ways to do this. But, you do not wan to use the
destroy action on pictures_controller. That action should be used to
destroy pictures not associations.

Option 1—Expose the join model and manage the association with standard
REST destroy action on the association model:

class Picture < ActiveRecord::Base
has_many :question_pictures
has_many :questions, :through => :question_pictures
end

class Question < ActiveRecord::Base
has_many :question_pictures
has_many :pictures, :through => :question_pictures
end

class QuestionPicture < ActiveRecord::Base
belongs_to :question
belongs_to :picture
end

question_pictures_controller
-----------------
def destroy
question_picture = QuestionPicture.find(params[:id])
question_picture.destroy
end

Option 2—Add an additional RESTful action to questions_controller

config/routes.rb
-------------------
resources :questions do
  delete 'remove_picture', :on => :member
end

questions_controller.rb
-------------------
def remove_picture
question = Question.find(:id)
picture = question.pictures.find(params[:picture_id])
question.pictures.delete(picture)
end

Example URL:
DELETE: http://example.com/galleries/1/remove_picture/?picture_id=1

P.S. None of this code has been tested. Just wrote it by memory.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/aff8498fa1b785d0249280cff48a07c8%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 31 May 2013 16:09, Cameron D. <lists@ruby-forum.com> wrote:
> Hello.
>
> So I created a new application (named guestbook), controllers, and
> entry(named sign_in) in Rails. I uncommented the "match
> ':controller......' and the 'root :to => 'welcome#index' lines in
> config/locales/routes.rb file. When I type
> "localhost:3000/entries/sign_in", I received the "Routing Error, No
> route matches [GET] "/entries/sign_in"
>
> When running rake routes: entries_sign_in GET
> /entries/sign_in(.:format) entries#sign_in root/welcome#index
> /:controller(/:action(/:id)(.:format) :controller#:action

Did you restart the server after changing routes.rb? This is one of
the few occasions when a restart is necessary.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtbi00f%3D3K6ro%3DHp0s4Fz0Z%2BQ%3D%2B%2BVPundBuqmgvHXrmGg%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Colin Law wrote in post #1110802:
> On 31 May 2013 15:21, Paul Bergstrom <lists@ruby-forum.com> wrote:
>> I'm kind of lost with Rails right now. What was simple and beautiful is
>> no more. I've never understood REST and I think this is what gives me
>> problems.
>>
>> That and this compiling thing in production.
>>
>> But to put it short and back to my question, can I forget compiling in
>> developing mode, not part of my problem?
>
> Ruby is not compiled. Please describe exactly the problem that you
> are seeing. In order for us to help we must first understand the
> problem.
>
> Colin

I understand. It was a file that didn't loaded as excepted. But could
have been an error on my part, e g wrong file name or something.

It helps to know that I don't have to worry about compiling in
development only production mode. Because in production I have had
problems with this, and from what I can understand I'm not the only one.
Hence my question for clarification.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2960886e75869039f1fcdaaf6310e873%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Fri, May 31, 2013 at 6:50 AM, Dave Castellano <lists@ruby-forum.com> wrote:

> My problem is, I cannot figure out how to delete the picture
> in the question and at the same time not delete it from the gallery ie
> delete the pictures_questions association but not the
> galleries_pictures association.

http://guides.rubyonrails.org/association_basics.html#has_and_belongs_to_many-association-reference

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yDB8TodXqJxcbR1YeqcPSsrZLOnuff%2B96vGi2Dv9%2B1gLg%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hello.

So I created a new application (named guestbook), controllers, and
entry(named sign_in) in Rails. I uncommented the "match
':controller......' and the 'root :to => 'welcome#index' lines in
config/locales/routes.rb file. When I type
"localhost:3000/entries/sign_in", I received the "Routing Error, No
route matches [GET] "/entries/sign_in"

When running rake routes: entries_sign_in GET
/entries/sign_in(.:format) entries#sign_in root/welcome#index
/:controller(/:action(/:id)(.:format) :controller#:action

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/abad3b9784f8540c9b21b0ebdb7bee92%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 31 May 2013 15:21, Paul Bergstrom <lists@ruby-forum.com> wrote:
> Kad Kerforn wrote in post #1110772:
>> what do you mean by : Rails didn't compile in development
>> can you copy your log file in a gist ,
>>
>> Le vendredi 31 mai 2013 09:45:09 UTC+2, Ruby-Forum.com User a crit :
>
> Not sure what I mean. I just assumed it was something with compiling.
> But it could be something else. Not understanding Rails anymore is a
> major problem. :-)
>
> I'm kind of lost with Rails right now. What was simple and beautiful is
> no more. I've never understood REST and I think this is what gives me
> problems.
>
> That and this compiling thing in production.
>
> But to put it short and back to my question, can I forget compiling in
> developing mode, not part of my problem?

Ruby is not compiled. Please describe exactly the problem that you
are seeing. In order for us to help we must first understand the
problem.

Colin

>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f89cd3cb2b60becc05756704e6e32354%40ruby-forum.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLttvekj7DeX8EG%3DxecAazPbYhi%2BsrXyCpADgb%3DhUfu_EQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

You shouldn't need to precompile assets in development, if that's what you mean by compiling.

Walter

On May 31, 2013, at 10:21 AM, Paul Bergstrom wrote:

> But to put it short and back to my question, can I forget compiling in
> developing mode, not part of my problem?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/66D784F4-4111-431A-BBA3-CB47661733F8%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Kad Kerforn wrote in post #1110772:
> what do you mean by : Rails didn't compile in development
> can you copy your log file in a gist ,
>
> Le vendredi 31 mai 2013 09:45:09 UTC+2, Ruby-Forum.com User a crit :

Not sure what I mean. I just assumed it was something with compiling.
But it could be something else. Not understanding Rails anymore is a
major problem. :-)

I'm kind of lost with Rails right now. What was simple and beautiful is
no more. I've never understood REST and I think this is what gives me
problems.

That and this compiling thing in production.

But to put it short and back to my question, can I forget compiling in
developing mode, not part of my problem?

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f89cd3cb2b60becc05756704e6e32354%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Fri, May 31, 2013 at 6:02 AM, Seth F. <lists@ruby-forum.com> wrote:
> I have a basic knowledge of all of them, but the main reason of this
> task is to try and understand the logic of updating and maintaining the
> system. Basically, I'm trying to complete a puzzle of how these work
> together / in what way each of them reference eachother.

Maybe you should start by defining the two primary end points --
start, finish -- of the flow, and see how those pieces fit into that.

Also, it might be good to demonstrate that "basic knowledge" by
writing a 1-sentence description of the primary role of each of the
pieces you listed :-)

--
Hassan Schroeder ------------------------ hassan.schroeder@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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAN9iPuTzH2jCb16M3C2P_hQaAR2sqb8rXxBrom1_BTNw%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hello everyone

I am using rails 3.2.9 and using "browserstack-screenshot" gem for getting screentshot.
but i am getting the following error message. But i can login using this account setting and can get screenshot on their.

`http_response_code_check': 401 Unauthorized : Authentication Failed! (RuntimeError)


My code:

settings = {:username => "xxxxx", :password => "xxxxxx"}
client = Screenshot::Client.new(settings)

params = {
    :url => "www.google.com",
    :browsers => [
            {:os=>"Windows",:os_version=>"7",:browser=>"ie",:browser_version=>"8.0"}
    ]
}

request_id = @client.generate_screenshots(params)


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b978f08c-d1fc-46b3-9c20-da08fcce6a2f%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi,

I'm learning rails and have run into what for me is a difficult problem.
I have the following associations with a galleries_pictures and a
pictures_questions join table:

class Picture < ActiveRecord::Base
has_and_belongs_to_many :questions
has_and_belongs_to_many :galleries

class Question < ActiveRecord::Base
has_and_belongs_to_many :pictures

class Gallery < ActiveRecord::Base
has_and_belongs_to_many :pictures

In the edit question view, a question and its associated picture(s) can
be edited. My problem is, I cannot figure out how to delete the picture
in the question and at the same time not delete it from the gallery ie
delete the pictures_questions association but not the
galleries_pictures association.

The action called from the view deletes the row in both join tables:
def destroy
@picture = Picture.find(params[:id])
@picture.destroy

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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/40e6e1ce0974b1d11da257d0402b29eb%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I have a basic knowledge of all of them, but the main reason of this
task is to try and understand the logic of updating and maintaining the
system. Basically, I'm trying to complete a puzzle of how these work
together / in what way each of them reference eachother.

Thanks for your 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b8ed2be0161a6f3f5f7788905bc63fa0%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Can anyone recommend one way or the other this particular combination?

I'm not ready to jump on the Rails 4 bandwagon, I have a lot of sites to get up to 3.2 first, just as a jumping-off point for their eventual migration to 4. I just read that 1.9.3 is only going to be maintained until 2014, which in the time-scale of some of my projects is just moments away.

Trying to plan, any thoughts?

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1319F198-0D5A-43A2-B8BA-9E6A0607A62A%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Well in your second post you do not show the development.log, what I am asking is your console where you start your server.


also have you tried and raised your view to see if it gets hit.
like on line 1:

<%= raise "puts".inspect %>

if it doesnst raise we will know the view does not get hit and we try the controller then put the raise on the beginning if doesnt get hit then we know its on the routes or rails. try that as well

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba38458a-8032-4be2-ad02-7ad36c5a3679%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

What browser shows - i've linked in my first post.

What is shown in console - you can see in my second post.
That's all information that i can see..

пятница, 31 мая 2013 г., 15:58:23 UTC+4 пользователь and...@benjamin.dk написал:
And the server console does not give you any information?

when you hit the route what does the browser show?

On Friday, May 31, 2013 12:54:48 PM UTC+2, Sasha Chilly wrote:
Here it is:

<% set_editor_comment %>
<%= form_for @article do |f| %>
  <%= render "shared/error_messages", :target => @article %>
  <% if admin? %>
    <p>
      <%= f.label :user_id %>
      <%= f.select :user_id,  User.authors_and_admins.collect {|p| [ p.username, p.id ] } %>
    </p>
  <% end %>
  <p>
    <%= f.label :category_id %><%= mark_required(@article, :category_id) %><br/>
    <%= f.select :category_id,  Category.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true } %>
  </p>
  <p>
    <%= f.label :name %><%= mark_required(@article, :name) %><br/>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :preview %><%= mark_required(@article, :preview) %><br/>
    <%= f.text_area :preview, :size => "70x6" %>
  </p>
  <p>
    <%= f.label :body %><%= mark_required(@article, :body) %><br/>
    <%= f.text_area :body, :class => "mceEditor", :size => "100x20" %>
  </p>
  <% if admin? %>
    <p>
      <%= f.label :publish_on_main %>
      <%= f.check_box :publish_on_main %>
    </p>
  <% end %>
  <%= f.submit %>
<% end %>

<div style="margin-top: 10px;">
  <iframe src="<%= images_path %>" width="90%" height="500" name="imagesIframe"></iframe>
</div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/834c2df8-d30a-4103-89c9-9d73c51fa5ae%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

And the server console does not give you any information?


when you hit the route what does the browser show?

On Friday, May 31, 2013 12:54:48 PM UTC+2, Sasha Chilly wrote:
Here it is:

<% set_editor_comment %>
<%= form_for @article do |f| %>
  <%= render "shared/error_messages", :target => @article %>
  <% if admin? %>
    <p>
      <%= f.label :user_id %>
      <%= f.select :user_id,  User.authors_and_admins.collect {|p| [ p.username, p.id ] } %>
    </p>
  <% end %>
  <p>
    <%= f.label :category_id %><%= mark_required(@article, :category_id) %><br/>
    <%= f.select :category_id,  Category.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true } %>
  </p>
  <p>
    <%= f.label :name %><%= mark_required(@article, :name) %><br/>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :preview %><%= mark_required(@article, :preview) %><br/>
    <%= f.text_area :preview, :size => "70x6" %>
  </p>
  <p>
    <%= f.label :body %><%= mark_required(@article, :body) %><br/>
    <%= f.text_area :body, :class => "mceEditor", :size => "100x20" %>
  </p>
  <% if admin? %>
    <p>
      <%= f.label :publish_on_main %>
      <%= f.check_box :publish_on_main %>
    </p>
  <% end %>
  <%= f.submit %>
<% end %>

<div style="margin-top: 10px;">
  <iframe src="<%= images_path %>" width="90%" height="500" name="imagesIframe"></iframe>
</div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/03c13cba-f2c2-4d50-8e1d-2f162214891d%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Thanks Colin,Mike
I had done with instruction of You.And i tried with
gem install rails --version '3.2.13'
and add : [[ -s "$HOME/.rvm/scripts/rvm" ]] && source
"$HOME/.rvm/scripts/rvm" to Bashrc file
This run.Thanks a lot

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8b9dfb4344e2593763bf4fe25aeb8f12%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Here it is:

<% set_editor_comment %>
<%= form_for @article do |f| %>
  <%= render "shared/error_messages", :target => @article %>
  <% if admin? %>
    <p>
      <%= f.label :user_id %>
      <%= f.select :user_id,  User.authors_and_admins.collect {|p| [ p.username, p.id ] } %>
    </p>
  <% end %>
  <p>
    <%= f.label :category_id %><%= mark_required(@article, :category_id) %><br/>
    <%= f.select :category_id,  Category.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true } %>
  </p>
  <p>
    <%= f.label :name %><%= mark_required(@article, :name) %><br/>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :preview %><%= mark_required(@article, :preview) %><br/>
    <%= f.text_area :preview, :size => "70x6" %>
  </p>
  <p>
    <%= f.label :body %><%= mark_required(@article, :body) %><br/>
    <%= f.text_area :body, :class => "mceEditor", :size => "100x20" %>
  </p>
  <% if admin? %>
    <p>
      <%= f.label :publish_on_main %>
      <%= f.check_box :publish_on_main %>
    </p>
  <% end %>
  <%= f.submit %>
<% end %>

<div style="margin-top: 10px;">
  <iframe src="<%= images_path %>" width="90%" height="500" name="imagesIframe"></iframe>
</div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b602ba76-cc2a-4d68-9bf9-a6912083058d%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Colin Law wrote in post #1110759:
> On 31 May 2013 07:45, Vijay Maddipati <lists@ruby-forum.com> wrote:
>> I installed the ruby 1.9.3. while instillation rails, I am getting
>> instillation error. Below is the error
>
> I advise using rvm for installing ruby and rails. See http://rvm.io.
> That will handle all the dependencies for you if you.
>
> Colin

Thanks for your help. I installed rails in my system.

Regards,
Vijay.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed9a291ba3c2d0e7e47b8b6b701c47c6%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.