Ruby on Rails Tuesday, April 30, 2013

Hi,

downloading the ruby installer "rubyinstaller-2.0.0-p0.exe" and
configuring it, if the screen comes as you stated in your previous reply
i will let you know.
Yong Gu wrote in post #1107446:
> Hi,
>
> Did you install ruby environment on your computer? I do not have any
> experience on running ruby on Window 8. I think you could try this:
> http://www.racap.net/2012/02/how-to-install-ruby-on-rails-in-windows.html.
>
> --
> Yong Gu
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hi,

Did you install ruby environment on your computer? I do not have any experience on running ruby on Window 8. I think you could try this: http://www.racap.net/2012/02/how-to-install-ruby-on-rails-in-windows.html.

-- 
Yong Gu
Sent with Sparrow

On Wednesday, May 1, 2013 at 1:59 PM, gautam s. wrote:

Dear Yong Gu,

You guys are fast. I mean really fast i have been on unix forums
(unix.com) for a while, but replies this fast its amazing.
I have tried writing "rails s" it always says "sh.exe: rake: command not
found"

Do i need to use some other emacs as of now i am using Aptana Studio 3
on Windows 8 OS.

If you know of any better version tools or emacs or softwares for
running ruby easily on windows 8, do let me know i will download that
particular version.


Yong Gu wrote in post #1107444:
If the database is created and setup, then just run 'rails s' under the
project directory and open your browser to check http://localhost:3000.

If it is not, then you need to setup the database as below:

1. rake db:create // create the database
2. rake db:migrate // create the tables in the database
3. rake db:seed // if there is any data need to setup

For the database setup, see the config/database.yml to fill the correct
credential of you local database.

If there is any errors, please paste the log here and we can check it
together.

--
Yong Gu

--

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

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Dear Yong Gu,

You guys are fast. I mean really fast i have been on unix forums
(unix.com) for a while, but replies this fast its amazing.
I have tried writing "rails s" it always says "sh.exe: rake: command not
found"

Do i need to use some other emacs as of now i am using Aptana Studio 3
on Windows 8 OS.

If you know of any better version tools or emacs or softwares for
running ruby easily on windows 8, do let me know i will download that
particular version.


Yong Gu wrote in post #1107444:
> If the database is created and setup, then just run 'rails s' under the
> project directory and open your browser to check http://localhost:3000.
>
> If it is not, then you need to setup the database as below:
>
> 1. rake db:create // create the database
> 2. rake db:migrate // create the tables in the database
> 3. rake db:seed // if there is any data need to setup
>
> For the database setup, see the config/database.yml to fill the correct
> credential of you local database.
>
> If there is any errors, please paste the log here and we can check it
> together.
>
> --
> Yong Gu
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

If the database is created and setup, then just run 'rails s' under the project directory and open your browser to check http://localhost:3000.

If it is not, then you need to setup the database as below:

1. rake db:create // create the database
2. rake db:migrate // create the tables in the database
3. rake db:seed // if there is any data need to setup

For the database setup, see the config/database.yml to fill the correct credential of you local database.

If there is any errors, please paste the log here and we can check it together. 

-- 
Yong Gu
Sent with Sparrow

On Wednesday, May 1, 2013 at 1:40 PM, gautam s. wrote:

Hi,

I am extremely sorry for taking your quality time. But i am in a jam
now. This is what happened. I am a web developer with decent knowledge
of CSS, HTML, PHP, Unix, Shell, C++ and absolutely no knowledge of ruby.

I was working on a e-commerce module that i have to demonstrate
tomorrow. But i lost the whole code when my hard-disk crashed.
Now i am working on opencart to develop a module that i can show to save
my soul.
In meanwhile, i asked one of my friends if they had a spare code. he has
sent me an application but its in ruby. (i have no freaking idea how to
run it).

Therefore, i went on to net learnt a little bit of it, found out its
similar to shell in some ways.
Moreover, i downloaded Aptana studio 3, now i am going through his code,
but i am unable to launch it as an application.

Is there anyone who can give me some pointers on it.

Thanking you in advance.

--

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

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi,

I am extremely sorry for taking your quality time. But i am in a jam
now. This is what happened. I am a web developer with decent knowledge
of CSS, HTML, PHP, Unix, Shell, C++ and absolutely no knowledge of ruby.

I was working on a e-commerce module that i have to demonstrate
tomorrow. But i lost the whole code when my hard-disk crashed.
Now i am working on opencart to develop a module that i can show to save
my soul.
In meanwhile, i asked one of my friends if they had a spare code. he has
sent me an application but its in ruby. (i have no freaking idea how to
run it).

Therefore, i went on to net learnt a little bit of it, found out its
similar to shell in some ways.
Moreover, i downloaded Aptana studio 3, now i am going through his code,
but i am unable to launch it as an application.

Is there anyone who can give me some pointers on it.

Thanking you in advance.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Jim ruther Nill wrote in post #1107440:
> p h.values_at[*ar]
>
> should be
>
> p h.values_at(*ar)
>
>
> On Wed, May 1, 2013 at 12:50 PM, Love U Ruby <lists@ruby-forum.com>
> wrote:
>
>> 'arg0' => '126150656000',
>> 'arg11' => '32',
>> Posted via http://www.ruby-forum.com/.
>>
> --

Thanks! It was a typo.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

p h.values_at[*ar]

should be

p h.values_at(*ar)


On Wed, May 1, 2013 at 12:50 PM, Love U Ruby <lists@ruby-forum.com> wrote:
While the below code working :-


m = {:a => 2, :b => 3,:c => 44,:g => 14}
a = [:a,:b,:g]
p m.values_at(*[:a,:b,:g]) #=> [2, 3, 14]

why the below not working?

h = {
  'arg0' => '126150656000',
  'arg1' => 'Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz',
  'arg2' => '2790',
  'arg3' => '3276320768',
  'arg4' => '8467496960',
  'arg5' => 'Windows 7',
  'arg7' => 'amd64',
  'arg6' => '6.1',
  'arg8' => '2',
  'arg9' => '1920',
  'arg10' => '1200',
  'arg11' => '32',
}


p ar = h.keys.sort_by{|s| s[3..-1].to_i}
p h.values_at[*ar]
#=>`[]': wrong number of arguments (12 for 1..2) (ArgumentError)

Where did I mistake?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.





--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

While the below code working :-


m = {:a => 2, :b => 3,:c => 44,:g => 14}
a = [:a,:b,:g]
p m.values_at(*[:a,:b,:g]) #=> [2, 3, 14]

why the below not working?

h = {
'arg0' => '126150656000',
'arg1' => 'Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz',
'arg2' => '2790',
'arg3' => '3276320768',
'arg4' => '8467496960',
'arg5' => 'Windows 7',
'arg7' => 'amd64',
'arg6' => '6.1',
'arg8' => '2',
'arg9' => '1920',
'arg10' => '1200',
'arg11' => '32',
}


p ar = h.keys.sort_by{|s| s[3..-1].to_i}
p h.values_at[*ar]
#=>`[]': wrong number of arguments (12 for 1..2) (ArgumentError)

Where did I mistake?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails



On Tuesday, April 30, 2013 12:45:54 PM UTC+1, akkdio wrote:

So this works but it seems like it is not the best way to do it - seems like the controller would get bloated if there are a lot of categories.  Another issue  is that in the scope I have to use category_id => 3 to get the appetizers to list.  I would like at least to have "post.category.name => "Appetizers" so to be more clear about what is being scoped but this give me an error: 

    undefined method `key?' for nil:NilClass

Rails doesn't understand that post.category.name in the where clause (not in relation to a specific post) means to add a condition on the category's name. You'd have to do something like

    scope :appetizers, -> {joins(:category).where(:categories => {:name => 'Appetizers'})}

 

I have a feeling there are many ways to display the appetizer listing in the view.  Adding actions to the controller and adding routes seems not elegant.  Can you suggest an alternative and or point to the concept I seem to be missing in understanding how to display a subset of information from the database in the view.   I would like to use scopes and perhaps a method in the model... 


I'd suggest adding a single route/action for displaying the posts from any category. You can still make it look pretty by setting up slugs for categories and fetching categories by slug rather than id (friendly_id is one of many gems that do this).

You might also consider doing something like this, instead of using scopes (assuming you have this by category action)

   @posts = Category.find(params[:category_id]).posts


Fred
 

Again, sorry for not posting the error, I appreciate any comments you can give on the subject.     


--
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/msg/rubyonrails-talk/-/UP46FpLAm94J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails



On Tuesday, April 30, 2013 10:10:20 AM UTC+1, Farukh D.M wrote:

Hey,

I need to find out the impact of vulnerability: CVE-2013-1854 Symbol DoS vulnerability in Active Record

Is there a way I can test my application with DoS attack by doing some manual code or something like that.

On rails console, I tried to do something like:
User.where(:email => {:email => 'test'})

> SELECT `users`.* FROM `users` WHERE `email`.`email` = 'test'

it gave "ActiveRecord::StatementInvalid:" exception.
How would requests like this lead to DoS attack. Its just like any other invalid sql.

The vulnerability is that (depending on how you use activerecord), an attacker can cause arbitrary strings to be turned into symbols. Ruby never garbage collects symbols, so this can be used to exhaust all the memory available to your application.

Fred

 

Please help me out with the reference to example(s) causing mentioned vulnerabilities.

Thanks


--
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/msg/rubyonrails-talk/-/7Yhg2zp4DgAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hello all,


I am downloading a file from S3 for processing with paperclip and
delayed_paperclip. The original downloaded temp file is remaining after
processing completes. I'm pretty sure I could add the code to remove
this file in the after_post_processing method.

However, since the process gets handed over to delayed_paperclip, I do
not know how to access the pathname of the original file once processing
is complete? Is paperclip storing the pathname in a property somewhere?

TIA,

Dan

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 30 April 2013 13:37, Love U Ruby <lists@ruby-forum.com> wrote:
> ...
> Thanks for your suggestions! Now I need to install selenium-webdriver
> also.But I did `gem install selenium-webdriver`. But it seems not
> installed. As when I am doing require `selenium-webdriver` giving me
> load error.

Did you get any errors when you installed it?

What do you see if you do
gem list selenium-webdriver

If it does not show it installed then try
gem install selenium-webdriver
again. If you still can't get it to install post the result of the
two commands here. Copy/Paste the text so we can check for typos.

Also post the result of the require command.

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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

The usual way to start webrick in RoR is with the command:

$ rails s

and the usual way to stop it is to enter CTRL-C in the same window.

On Monday, April 29, 2013 11:05:51 PM UTC-4, Ruby-Forum.com User wrote:

Tom wrote in post #109027:

...

> I usually do this:

> ps aux | grep ruby
> kill -9 [PID]
>
> Where PID is the process ID you get from doing the PS command. There
> might be a better way.
>
> -Tom

Thank you Tom

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To 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/msg/rubyonrails-talk/-/q-3qJ_oI2LcJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Jordon Bedwell wrote in post #1107360:
> On Mon, Apr 29, 2013 at 2:24 PM, Love U Ruby <lists@ruby-forum.com>

> Just to give you a heads up for next time: `curl -L
> https://get.rvm.io|bash -s head --ruby=2.0.0 --autolibs=enabled` would
> have installed
> everything from libxml2 down to Git for you and installed Ruby 2.0.0 and
> Rails as well. You can see a list of what we install for you here:
>
https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/requirements/ubuntu#L83

Thanks for your suggestions! Now I need to install selenium-webdriver
also.But I did `gem install selenium-webdriver`. But it seems not
installed. As when I am doing require `selenium-webdriver` giving me
load error.

Can you suggest about this for `Ubuntu 13.04` OS?


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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

change in database.yml , use the syntax which is needed for PG , and again run command
bundle exec rake db:create
bundle exec rake db:migrate


On Tue, Apr 30, 2013 at 4:25 PM, botp <botpena@gmail.com> wrote:
On Tue, Apr 30, 2013 at 8:21 AM, <dil.takodil@gmail.com> wrote:
I saw some of the tutorials on how to migrate from sqlite to postgresql, but it is either for mac or it is for a new/fresh app. What if I already have an App with data sqlite in it. I am using rails 3.2.2 and windows 7. Anyone knows which is the best way to migrate sqlite to postgresql? Thanks




look for the taps gem

best regards -botp

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails



On Monday, April 29, 2013 6:39:56 PM UTC-4, akkdio wrote:

 am a beginner and I appreciate an answer to help me understand where my knowledge gap is:

The app is to display a post. The posts belong to a category (appetizers, entrees...) My thought was to use scopes to display all the appetizers on the posts in one view and then have the entrees in another view and so on.

The models:

class Post < ActiveRecord::Base  attr_accessible :body, :category_id, :title    belongs_to :category    scope :appetizers, -> { where(post.category.name => "Appetizers")}    end      class Category < ActiveRecord::Base  attr_accessible :name    has_many :posts  end       

In the view I want to loop through the posts where the category name is "Appetizers".

<table>    <tr>      <th>Title</th>      <th>Body</th>      <th>Category</th>    </tr>      <% @post.appetizers.each do |app| %>    <tr>      <td><%= app.title %></td>      <td><%= app.body %></td>      <td><%= app.category.name%></td>    </tr>    <% end %>   </table>   

I am getting an "undefined method" error. I have tried searching for an example here that explains what is a correct solution. I also tried creating a method in the Post model like this:

  def appetizers_list      @appetizer_list = Post.appetizers.all      end  

Then call the method in the view:

 <% @appetizer_list.each do |app| %>   <tr>   <td><%= app.title %></td>   <td><%= app.body %></td>   <td><%= app.category.name%></td>    </tr>  

Obviously I am confusing what needs to be done after creating the scope and how to get the view to "see" it. Or if I need a scope at all and it can be done in a more simple way.

So is there a best practices for retrieving subsets of data in rails and displaying them to the view?


Apologies to both Colin and Tamouse.  Indeed as Colin surmised the error is:

     undefined method `each' for nil:NilClass

     Extracted source (around line #13):

    10: 

     11:   </tr>

     12: 

      13: <% @appetizers_list.each do |app| %>

       14:   <tr>

       15:     <td><%= app.title %></td>

        16:     <td><%= app.body %></td>


I did try what was suggested in this blog post - http://www.jacopretorius.net/2012/02/scopes-in-rails.html which involves creating a controller action adding a custom route and creating a link_to in the view.   This worked but at the expense of adding more to the controller.  Here is that solution:


Action in Post Controller:

       def appetizers

      @posts = Post.appetizers

      render 'index' 

       end

Route: 

         get 'posts/appetizers' => 'posts#appetizers', :as => 'appetizers_posts'

Change in Post Model:

            scope :appetizers, -> { where(:category_id => 3)}

And change in the view to be a link:

         <% @posts.each do |post| %>

        <tr>

           <td><%= post.title %></td>

           <td><%= post.body %></td>

           <td><%= post.category.name%></td>

         </tr>

        <% end %>

        <%= link_to 'Appetizers', appetizers_posts_path %>

So this works but it seems like it is not the best way to do it - seems like the controller would get bloated if there are a lot of categories.  Another issue  is that in the scope I have to use category_id => 3 to get the appetizers to list.  I would like at least to have "post.category.name => "Appetizers" so to be more clear about what is being scoped but this give me an error:

    undefined method `key?' for nil:NilClass

I have a feeling there are many ways to display the appetizer listing in the view.  Adding actions to the controller and adding routes seems not elegant.  Can you suggest an alternative and or point to the concept I seem to be missing in understanding how to display a subset of information from the database in the view.   I would like to use scopes and perhaps a method in the model... 

Again, sorry for not posting the error, I appreciate any comments you can give on the subject.     


--
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/msg/rubyonrails-talk/-/f3C3hQ8k29AJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Mon, Apr 29, 2013 at 2:24 PM, Love U Ruby <lists@ruby-forum.com> wrote:
kirti@kirti-Aspire-5733Z:~$ irb
2.0.0p0 :001 > require 'nokogiri'
 => true
2.0.0p0 :002 >


Just to give you a heads up for next time: `curl -L https://get.rvm.io |bash -s head --ruby=2.0.0 --autolibs=enabled` would have installed everything from libxml2 down to Git for you and installed Ruby 2.0.0 and Rails as well.  You can see a list of what we install for you here: https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/requirements/ubuntu#L83

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Tue, Apr 30, 2013 at 8:21 AM, <dil.takodil@gmail.com> wrote:
I saw some of the tutorials on how to migrate from sqlite to postgresql, but it is either for mac or it is for a new/fresh app. What if I already have an App with data sqlite in it. I am using rails 3.2.2 and windows 7. Anyone knows which is the best way to migrate sqlite to postgresql? Thanks




look for the taps gem

best regards -botp

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Tue, Apr 30, 2013 at 3:21 AM, <dil.takodil@gmail.com> wrote:
I saw some of the tutorials on how to migrate from sqlite to postgresql, but it is either for mac or it is for a new/fresh app. What if I already have an App with data sqlite in it. I am using rails 3.2.2 and windows 7. Anyone knows which is the best way to migrate sqlite to postgresql? Thanks

As far as I understood, you want to move your data from sqlite to postgres.... assuming you already created the db in postgres, maybe you can do a dump from sqlite and then use that dump in postgres
 

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Tuesday, April 30, 2013 8:48:50 AM UTC+1, rihad wrote:
> Hi, just started reading http://guides.rubyonrails.org/getting_started.html
>
>
>
>
> In case we need to show a field in several templates, we need to
>
> duplicate its type (text_field etc). The type belongs to the field, so
>
> why not remove this repetition by making a self-contained "field" like
>
> f.name, or f.label, or f.content, that would encompass rendering logic
>
> and would spit out proper form snippet: <%= f.name %> Then if someone
>
> wanted to override how a certain field is rendered, they could spell
>
> everything out as above.

You certainly can do that - I think either the guide or the api docs for form_for show how to subclass FormBuilder to achieve this. This is something that is going to be quite specific to each app so doesn't belong in rails itself

Fred

--
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/msg/rubyonrails-talk/-/j8dZPGNHWhUJ.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey,


I need to find out the impact of vulnerability: CVE-2013-1854 Symbol DoS vulnerability in Active Record

Is there a way I can test my application with DoS attack by doing some manual code or something like that.

On rails console, I tried to do something like:
User.where(:email => {:email => 'test'})

> SELECT `users`.* FROM `users` WHERE `email`.`email` = 'test'

it gave "ActiveRecord::StatementInvalid:" exception.
How would requests like this lead to DoS attack. Its just like any other invalid sql.


Please help me out with the reference to example(s) causing mentioned vulnerabilities.

Thanks


--
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/msg/rubyonrails-talk/-/Kb2nX5NkSqwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I saw some of the tutorials on how to migrate from sqlite to postgresql, but it is either for mac or it is for a new/fresh app. What if I already have an App with data sqlite in it. I am using rails 3.2.2 and windows 7. Anyone knows which is the best way to migrate sqlite to postgresql? Thanks

--
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/msg/rubyonrails-talk/-/mMd3RQo6HVsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi, just started reading http://guides.rubyonrails.org/getting_started.html
and this code example:
<%= form_for(@post) do |f| %>
...
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content %>
</div>
<div class="actions">
<%= f.submit %>
</div>

In case we need to show a field in several templates, we need to
duplicate its type (text_field etc). The type belongs to the field, so
why not remove this repetition by making a self-contained "field" like
f.name, or f.label, or f.content, that would encompass rendering logic
and would spit out proper form snippet: <%= f.name %> Then if someone
wanted to override how a certain field is rendered, they could spell
everything out as above.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 30 April 2013 07:25, kanna <vtrkanna@gmail.com> wrote:
> Hi all,
>
> I DONT KNOW WHAT IS THIS WHEN I RUN SERVER OR CONSOLE
>
> ITS COMMING. PLEASE ANYBODY TELME WHATS PROBLEM WHATS SOLLUTION
>
> rajesh@rajesh:~/workspace/apl$ ruby script/console
> Loading development environment (Rails 2.3.2)
> NOTE: Gem.source_index is deprecated, use Specification. It will be removed
> on or after 2011-11-01.

You are probably using a version of rubygems that is fairly new with
an extremely old version of rails. Why are you using such an old
version of rails? You can find which version of rubygems you are
using by
gem -v
You can either use a later version of rails (you should be using rails
3 for new projects) or downgrade rubygems. I am not sure but I think
1.3.7 may be what you want for rails 2. Google is your friend.

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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails Monday, April 29, 2013

On 29 April 2013 23:39, akkdio <akkdio@gmail.com> wrote:
> am a beginner and I appreciate an answer to help me understand where my
> knowledge gap is:
>
> The app is to display a post. The posts belong to a category (appetizers,
> entrees...) My thought was to use scopes to display all the appetizers on
> the posts in one view and then have the entrees in another view and so on.
>
> The models:
>
> class Post < ActiveRecord::Base
> attr_accessible :body, :category_id, :title
>
> belongs_to :category
>
> scope :appetizers, -> { where(post.category.name => "Appetizers")}
>
> end
>
>
> class Category < ActiveRecord::Base
> attr_accessible :name
>
> has_many :posts
> end
>
> In the view I want to loop through the posts where the category name is
> "Appetizers".
>
> <table>
> <tr>
> <th>Title</th>
> <th>Body</th>
> <th>Category</th>
> </tr>
>
> <% @post.appetizers.each do |app| %>
> <tr>
> <td><%= app.title %></td>
> <td><%= app.body %></td>
> <td><%= app.category.name%></td>

As tamouse suggests it would have been better if you could have told
us the exact error and which line it is on, but if the error is on
this line, and is saying calling method name for nil, then it is
because one of the posts does not have an associated category (so
app.category is nil)

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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hi all,

I DONT KNOW WHAT IS THIS WHEN I RUN SERVER OR CONSOLE

ITS COMMING. PLEASE ANYBODY TELME WHATS PROBLEM WHATS SOLLUTION

rajesh@rajesh:~/workspace/apl$ ruby script/console
Loading development environment (Rails 2.3.2)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/rajesh/.rvm/gems/ruby-1.8.7-p370@cybermedia_stage/gems/rails-2.3.2/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /home/rajesh/.rvm/gems/ruby-1.8.7-p370@cybermedia_stage/gems/rails-2.3.2/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/rajesh/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/rajesh/.rvm/gems/ruby-1.8.7-p370@cybermedia_stage/gems/rails-2.3.2/lib/rails/vendor_gem_source_index.rb:100.
/home/rajesh/workspace/Cybermedia_Test/app/helpers/application_helper.rb:2263: warning: character class has `-' without escape
/home/rajesh/workspace/Cybermedia_Test/app/models/site.rb:612: warning: don't put space before argument parentheses
/home/rajesh/workspace/Cybermedia_Test/app/models/site.rb:616: warning: don't put space before argument parentheses
>>

--
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/msg/rubyonrails-talk/-/-MYwbpX3NWgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Tom wrote in post #109027:

...

> I usually do this:

> ps aux | grep ruby
> kill -9 [PID]
>
> Where PID is the process ID you get from doing the PS command. There
> might be a better way.
>
> -Tom

Thank you Tom

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails


On Apr 29, 2013 5:40 PM, "akkdio" <akkdio@gmail.com> wrote:
>
>  am a beginner and I appreciate an answer to help me understand where my knowledge gap is:
>
> The app is to display a post. The posts belong to a category (appetizers, entrees...) My thought was to use scopes to display all the appetizers on the posts in one view and then have the entrees in another view and so on.
>
> The models:
>
> class Post < ActiveRecord::Base
> attr_accessible :body, :category_id, :title
>
> belongs_to :category
>
> scope :appetizers, -> { where(post.category.name => "Appetizers")}
>
> end
>
>
> class Category < ActiveRecord::Base
> attr_accessible :name
>
> has_many :posts
> end    
>
> In the view I want to loop through the posts where the category name is "Appetizers".
>
> <table>
>   <tr>
>     <th>Title</th>
>     <th>Body</th>
>     <th>Category</th>
>   </tr>
>
>   <% @post.appetizers.each do |app| %>
>   <tr>
>     <td><%= app.title %></td>
>     <td><%= app.body %></td>
>     <td><%= app.category.name%></td>
>   </tr>
>   <% end %>
>  </table>
>
> I am getting an "undefined method" error. I have tried searching for an example here that explains what is a correct solution. I also tried creating a method in the Post model like this:
>
>   def appetizers_list
>
>   @appetizer_list = Post.appetizers.all
>
>   end
>
> Then call the method in the view:
>
>  <% @appetizer_list.each do |app| %>
>  <tr>
>  <td><%= app.title %></td>
>  <td><%= app.body %></td>
>  <td><%= app.category.name%></td>
>   </tr>
>
> Obviously I am confusing what needs to be done after creating the scope and how to get the view to "see" it. Or if I need a scope at all and it can be done in a more simple way.
>
> So is there a best practices for retrieving subsets of data in rails and displaying them to the view?

what and where is the reported error?  

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

 am a beginner and I appreciate an answer to help me understand where my knowledge gap is:

The app is to display a post. The posts belong to a category (appetizers, entrees...) My thought was to use scopes to display all the appetizers on the posts in one view and then have the entrees in another view and so on.

The models:

class Post < ActiveRecord::Base  attr_accessible :body, :category_id, :title    belongs_to :category    scope :appetizers, -> { where(post.category.name => "Appetizers")}    end      class Category < ActiveRecord::Base  attr_accessible :name    has_many :posts  end       

In the view I want to loop through the posts where the category name is "Appetizers".

<table>    <tr>      <th>Title</th>      <th>Body</th>      <th>Category</th>    </tr>      <% @post.appetizers.each do |app| %>    <tr>      <td><%= app.title %></td>      <td><%= app.body %></td>      <td><%= app.category.name%></td>    </tr>    <% end %>   </table>   

I am getting an "undefined method" error. I have tried searching for an example here that explains what is a correct solution. I also tried creating a method in the Post model like this:

  def appetizers_list      @appetizer_list = Post.appetizers.all      end  

Then call the method in the view:

 <% @appetizer_list.each do |app| %>   <tr>   <td><%= app.title %></td>   <td><%= app.body %></td>   <td><%= app.category.name%></td>    </tr>  

Obviously I am confusing what needs to be done after creating the scope and how to get the view to "see" it. Or if I need a scope at all and it can be done in a more simple way.

So is there a best practices for retrieving subsets of data in rails and displaying them to the view?

--
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/msg/rubyonrails-talk/-/FFGnFw6IEFsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Finally i am done:

kirti@kirti-Aspire-5733Z:~$ sudo apt-get install libxml2-dev
libxslt1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2-dev is already the newest version.
libxslt1-dev is already the newest version.
The following package was automatically installed and is no longer
required:
vim-runtime
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

kirti@kirti-Aspire-5733Z:~$ gem install nokogiri
Fetching: nokogiri-1.5.9.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.9
Parsing documentation for nokogiri-1.5.9
unable to convert "\x90" from ASCII-8BIT to UTF-8 for
lib/nokogiri/nokogiri.so, skipping
Installing ri documentation for nokogiri-1.5.9
1 gem installed

kirti@kirti-Aspire-5733Z:~$ irb
2.0.0p0 :001 > require 'nokogiri'
=> true
2.0.0p0 :002 >

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 29 April 2013 18:08, Love U Ruby <lists@ruby-forum.com> wrote:
> Carlos Mathiasen wrote in post #1107144:
>> Nokogiri is a gem, them you only need
>>
>> gem install nokogiri
>>
>> but first you need install this libraries for ubuntu[0]:
>>
>> sudo apt-get install libxml2 libxml2-dev libxslt libxslt-de
>
> Tried but got error:
>
> kirti@kirti-Aspire-5733Z:~$ sudo apt-get install libxml2 libxml2-dev
> libxslt libxslt-dev
> [sudo] password for kirti:
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
> E: Unable to locate package libxslt

You don't need libxslt, which is lucky as it does not exist. Repeat
the apt-get but leave out libxslt.

Colin

> kirti@kirti-Aspire-5733Z:~$
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Marnen Laibow-Koser wrote in post #871670:
> Alex Wayne wrote:
>> I'm sure this is easy since rails does this internally, but I need to
>> convert a string of url formatted variables
>> "foo=bar&baz=snoo&why=because" to a hash, and I need to convert a hash
>> to url format.
>>
>> Now before I roll my own methods to do this, does rails expose this
>> functionality somehow?
>
> Hold it. Why are you doing this in the first place? If it's part of
> request processing or URL generation, Rails will already do it for you.
> I'm not sure why you'd need this directly; please explain.
>
> Best,
> -- 
> Marnen Laibow-Koser
> http://www.marnen.org
> marnen@marnen.org

I want to link to '/auth/facebook' with parameters but that path is
handled by the omniauth gem and doesn't appear in my routes file.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Carlos Mathiasen wrote in post #1107144:
> Nokogiri is a gem, them you only need
>
> gem install nokogiri
>
> but first you need install this libraries for ubuntu[0]:
>
> sudo apt-get install libxml2 libxml2-dev libxslt libxslt-de

Tried but got error:

kirti@kirti-Aspire-5733Z:~$ sudo apt-get install libxml2 libxml2-dev
libxslt libxslt-dev
[sudo] password for kirti:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
E: Unable to locate package libxslt
kirti@kirti-Aspire-5733Z:~$

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Rails Developer and Database Administrator

Peregrine Energy Group, a small energy efficiency consulting company in Boston, MA, helps large organizations understand and manage their energy usage.  At the core of our consulting and software services are reams of energy use data, and web-based interface that helps our clients make sense of it all.

We are seeking someone to continue development on our Ruby on Rails based energy information web application and to help manage the backend MySQL database that drives it.

While the position includes aspects of traditional database administration and data management, we hope the successful candidate will build the tools to automate these processes or make them web-accessible administration features of the rails application.

There will also be a few specific rails development tasks for new features to be added both on the backend and the user interface of the website.

Responsibilities:

·         Maintain source code for Ruby on Rails application development

·         Identify, track, and fix bugs that our users encounter

·         Develop tools for interfacing with third party web applications

·         Develop new features in response to client needs and user feedback

·         Assist in day-to-day database management

·         Assist in the design of new MySQL database systems

Required Experience and Background:

·         BS Computer Science or equivalent

·         Meticulous attention to detail

·         Experience developing and deploying web applications in Ruby on Rails

·         Experience with SQL database administration

·         Experience with REST-based APIs a plus.

·         Experience with Amazon AWS a plus

·         2 or more years work experience

Interested? Please email a cover letter and resume to mpatton@peregrinegroup.com.

Thanks,

Marlana Patton
Director, Marketing & Communications
Peregrine Energy Group
mpatton@peregrinegroup.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/msg/rubyonrails-talk/-/QHgzJJHzOSYJ.
For more options, visit https://groups.google.com/groups/opt_out.