[Rails] Re: Help Installing rbenv?

2014-02-12 Thread johny why
Ok, i got rbenv installed, and Ruby using ruby-build. 

followed instructions here:
https://github.com/sstephenson/rbenv#installation

next, going to use gems to install sqlite and rails. 

not sure yet if the gems are tied to the active ruby (set by rbenv), but 
i'll find out!

thx 4 help!

-- 
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+unsubscr...@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/f9131f58-cb0e-447f-8d00-fea4a510e96b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Cucumber test question

2014-02-12 Thread Alexandru-Emil Lupu
Hello! 
I might be wrong, but i think this is causing you problems: 

Given(/^there is at least (\d+) staff info record$/) do |arg1|
 assert_difference('StaffInfo.count', 1) do
   @staff_info = FactoryGirl.create :staff_info
 end
end

When(/^the shirt size field is empty$/) do
 assert @staff_info.update_attribute(:shirt_size, nil)
end


Most probably is because you are combining cucumber with Rails test, meaning 
you managed to perform a test in a test ... Those assertions might be your 
problem... 

I haven't met this behavior, but most probably your databse_cleaner is cleaning 
your test after those assertions, which is inside your scenario. 

I'd go for something like this:

# Populating my Db and Make sure i have at least one 
Given /^there is at least (\d+) staff info record$/ do |arg1|
  @staff_info = FactoryGirl.create :staff_info
  (arg1.to_i - 1).times do 
FactoryGirl.create :staff_info
  end
end 

# Make sure my model is empty 
When /^the shirt size field is empty$/ do
 @staff_info.update_attribute(:shirt_size, nil)
end



In my support env.rb i would add 

World FactoryGirl::Syntax::Methods

Then use create(:staff_info) instead of full FactoryGirl.create syntax ... 

Tks. 
A.

On 12 Feb 2014, at 15:43, jsnark  wrote:

> 
> 
> On Tuesday, February 11, 2014 3:43:40 PM UTC-5, Vell wrote:
> Hello all,
> 
> I am trying to understand when I try to run a test in cucumber what I am 
> missing that it is failing. I am using FactoryGirl to create my records and 
> using cucumber to test my logic however I know that I am doing something 
> wrong in my testing I just can't seem to figure out what. Here is what I have:
> 
> Feature:
> 
> Feature: All features related to staff info
>   Scenario: notification for empty shirt size
> Given there is at least 1 staff info record
> When the shirt size field is empty
> And the shirt size check is run
> Then the system should send an email notification
> 
> Steps:
> 
> Given(/^there is at least (\d+) staff info record$/) do |arg1|
>   assert_difference('StaffInfo.count', 1) do
> @staff_info = FactoryGirl.create :staff_info
>   end
> end
> 
> When(/^the shirt size field is empty$/) do
>   assert @staff_info.update_attribute(:shirt_size, nil)
> end
> 
> When(/^the shirt size check is run$/) do
>   StaffInfo.check_empty_shirt_fields
> end
> 
> Then(/^the system should send an email notification$/) do
>   pending # express the regexp above with the code you wish you had
> end
> 
> Model:
> 
> class StaffInfo < ActiveRecord::Base
>   belongs_to :person
>   scope :empty_shirt_fields, -> { where('shirt_size in (?)', [nil, '']) }
>   
>   def self.check_empty_shirt_fields
> staff_with_missing_shirt_sizes = StaffInfo.empty_shirt_fields
> debugger
> send_empty_shirt_size_notification staff_with_missing_shirt_sizes if 
> staff_with_missing_shirt_sizes.size >  0
>   end
>   
>   def send_empty_shirt_size_notification(staff_records)
> Mailer.missing_shirt_size(staff_records).deliver
>   end
> end
> 
> What is happening is, when I hit the 3rd test I did a check to see if the 
> record was present (StaffInfo.count) and it was. But after running   
> StaffInfo.check_empty_shirt_fields, I did a check for the record and it was 
> gone. I am not understanding how my record could have disappeared when I all 
> my method was doing was checking for any records with a missing field.
> 
> Anyone have any ideas?
> 
> The default behavior of cucumber is to run each scenario in a transaction and 
> then do a rollback when the scenario completes.  The behavior is specified by 
> the DatabaseCleaner.strategy in the env.rb file/
> 
> -- 
> 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+unsubscr...@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/f1a540c9-e0db-41bb-8430-41863b7eae72%40googlegroups.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+unsubscr...@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/AA719BA5-3853-4613-8A93-D5E7DF899EB7%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Re: Cucumber test question

2014-02-12 Thread Vell
I'm not sure I understand. This is all one scenario so why would database
cleaner  delete my record in the middle of my scenario? or am I missing
something?

I create my record at the start of the scenario then run the method that
should check for this record but the record but it not there after that
method checks for the record. This should be in the same transaction right?
Even if I place debugger anywhere in the step definitions I should still
have one record right?


On Wed, Feb 12, 2014 at 8:43 AM, jsnark  wrote:

>
>
> On Tuesday, February 11, 2014 3:43:40 PM UTC-5, Vell wrote:
>>
>> Hello all,
>>
>> I am trying to understand when I try to run a test in cucumber what I am
>> missing that it is failing. I am using FactoryGirl to create my records and
>> using cucumber to test my logic however I know that I am doing something
>> wrong in my testing I just can't seem to figure out what. Here is what I
>> have:
>>
>> Feature:
>>
>> Feature: All features related to staff info
>>   Scenario: notification for empty shirt size
>> Given there is at least 1 staff info record
>> When the shirt size field is empty
>> And the shirt size check is run
>> Then the system should send an email notification
>>
>> Steps:
>>
>> Given(/^there is at least (\d+) staff info record$/) do |arg1|
>>   assert_difference('StaffInfo.count', 1) do
>> @staff_info = FactoryGirl.create :staff_info
>>   end
>> end
>>
>> When(/^the shirt size field is empty$/) do
>>   assert @staff_info.update_attribute(:shirt_size, nil)
>> end
>>
>> When(/^the shirt size check is run$/) do
>>   StaffInfo.check_empty_shirt_fields
>> end
>>
>> Then(/^the system should send an email notification$/) do
>>   pending # express the regexp above with the code you wish you had
>> end
>>
>> Model:
>>
>> class StaffInfo < ActiveRecord::Base
>>   belongs_to :person
>>   scope :empty_shirt_fields, -> { where('shirt_size in (?)', [nil, '']) }
>>
>>   def self.check_empty_shirt_fields
>> staff_with_missing_shirt_sizes = StaffInfo.empty_shirt_fields
>> debugger
>> send_empty_shirt_size_notification staff_with_missing_shirt_sizes if
>> staff_with_missing_shirt_sizes.size >  0
>>   end
>>
>>   def send_empty_shirt_size_notification(staff_records)
>> Mailer.missing_shirt_size(staff_records).deliver
>>   end
>> end
>>
>> What is happening is, when I hit the 3rd test I did a check to see if the
>> record was present (StaffInfo.count) and it was. But after running
>> StaffInfo.check_empty_shirt_fields, I did a check for the record and it
>> was gone. I am not understanding how my record could have disappeared when
>> I all my method was doing was checking for any records with a missing field.
>>
>> Anyone have any ideas?
>>
>
> The default behavior of cucumber is to run each scenario in a transaction
> and then do a rollback when the scenario completes.  The behavior is
> specified by the DatabaseCleaner.strategy in the env.rb file/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/rubyonrails-talk/U7nmztmWmzA/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> rubyonrails-talk+unsubscr...@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/f1a540c9-e0db-41bb-8430-41863b7eae72%40googlegroups.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+unsubscr...@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/CABO-7pVQDu-Y4E631G87VwkLYmSS1m-EOtALttK8xR3zaH5Zmg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Help Installing rbenv?

2014-02-12 Thread Robert Walker
John Weiss wrote in post #1136424:
> http://s19.postimg.org/ss009x84z/term.png

Did you also install ruby-build? rbenv does not come with the rbenv 
install command by default. rbenv itself is just a Ruby environment 
manager, and not an Ruby compile and install manage. That's what the 
ruby-build plugin does.

-- 
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+unsubscr...@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/840e4aae008db85c545fa57832acede2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: form_for (or erb) is pulling floats instead of ints in ActiveRecord

2014-02-12 Thread Cris Shupp
Fred,

Thanks for the interest:

[#,


#,


//Cris

-- 
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+unsubscr...@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/799d7d2addbdafea56544ea3802728c0%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Cucumber test question

2014-02-12 Thread jsnark


On Tuesday, February 11, 2014 3:43:40 PM UTC-5, Vell wrote:
>
> Hello all,
>
> I am trying to understand when I try to run a test in cucumber what I am 
> missing that it is failing. I am using FactoryGirl to create my records and 
> using cucumber to test my logic however I know that I am doing something 
> wrong in my testing I just can't seem to figure out what. Here is what I 
> have:
>
> Feature:
>
> Feature: All features related to staff info
>   Scenario: notification for empty shirt size
> Given there is at least 1 staff info record
> When the shirt size field is empty
> And the shirt size check is run
> Then the system should send an email notification
>
> Steps:
>
> Given(/^there is at least (\d+) staff info record$/) do |arg1|
>   assert_difference('StaffInfo.count', 1) do
> @staff_info = FactoryGirl.create :staff_info
>   end
> end
>
> When(/^the shirt size field is empty$/) do
>   assert @staff_info.update_attribute(:shirt_size, nil)
> end
>
> When(/^the shirt size check is run$/) do
>   StaffInfo.check_empty_shirt_fields
> end
>
> Then(/^the system should send an email notification$/) do
>   pending # express the regexp above with the code you wish you had
> end
>
> Model:
>
> class StaffInfo < ActiveRecord::Base
>   belongs_to :person
>   scope :empty_shirt_fields, -> { where('shirt_size in (?)', [nil, '']) }
>   
>   def self.check_empty_shirt_fields
> staff_with_missing_shirt_sizes = StaffInfo.empty_shirt_fields
> debugger
> send_empty_shirt_size_notification staff_with_missing_shirt_sizes if 
> staff_with_missing_shirt_sizes.size >  0
>   end
>   
>   def send_empty_shirt_size_notification(staff_records)
> Mailer.missing_shirt_size(staff_records).deliver
>   end
> end
>
> What is happening is, when I hit the 3rd test I did a check to see if the 
> record was present (StaffInfo.count) and it was. But after running   
> StaffInfo.check_empty_shirt_fields, I did a check for the record and it was 
> gone. I am not understanding how my record could have disappeared when I 
> all my method was doing was checking for any records with a missing field.
>
> Anyone have any ideas?
>

The default behavior of cucumber is to run each scenario in a transaction 
and then do a rollback when the scenario completes.  The behavior is 
specified by the DatabaseCleaner.strategy in the env.rb file/

-- 
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+unsubscr...@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/f1a540c9-e0db-41bb-8430-41863b7eae72%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] [advice] Viewing projects in portfolio

2014-02-12 Thread Stefanos I.
I want to create a portfolio viewer in which the user will click on an
image and then
 a light-box or modal will open showing the projects in a carousel like
this: http://i.imgur.com/URO7pFI.png

(you can zoom to see the three (3) Areas).
The AREA A will be showing the project's image, the AREA B is wrongly
there. It wont be used and the AREA C will be a footer showing the
current project's/image's details.

I tried to implement this but I ended up with two issues.

First: the modal/light-box will not resize according to the image's size
and second: the details shown on the footer of light-box/modal is always
the same (static and not dynamic). This is what i've done:
http://i.imgur.com/DoiGmzd.png . I think that I can somehow use ajax and
javascript in order to make the footer dynamically showing each projects
details.

However, is there any implementation that can do auto-resizing and
dynamic footer according to the image viewed? Or is this something I
have to figure out and implement by myself? I searched and found on the
net several jquery sliders. From what I found, none of them had a
solution to a dynamic footer and just one had auto-height resizing for
an in-page slider (not light-box or modal)

Any clues?
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+unsubscr...@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/1dfe3a6d2147e85e20c97680d09f2d27%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Help Installing rbenv?

2014-02-12 Thread John Weiss
 Hi, I'm seeking some help getting rbenv installed, for Ruby-on-Rails dev. 
https://github.com/sstephenson/rbenv
 
I'm running Puppy Linux X-Precise 2.2 non-pae, based on Puppy Linux 5.7.1, 
based on Ubuntu Precise Pangolin, in a VirtualBox. Kernel: Linux 3.2.48. I 
have git and other dev tools installed (via the Puppy DevX package, roughly 
equivalent to Arch Linux base-devel). Using sqlite. I used the Puppy 
Package Manager to install the rbenv package. These images show what's 
installed on the machine, and the problem. As you can see, rbenv is not 
quite behaving correctly. 
 
http://s19.postimg.org/ss009x84z/term.png 
http://s19.postimg.org/di052qcmr/packages.png
http://s19.postimg.org/8n6g4geb7/usr_bin.png
http://s19.postimg.org/4pj6f1rhv/libdir.png
http://s19.postimg.org/pc7w0dawj/sqlite.png
 
Hope somebody can help! 
 
Thx, 
John

-- 
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+unsubscr...@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/46fdf131-ec5f-48a3-b81e-d738f640d943%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: form_for (or erb) is pulling floats instead of ints in ActiveRecord

2014-02-12 Thread Frederick Cheung
On Tuesday, February 11, 2014 4:46:41 PM UTC, Ruby-Forum.com User wrote:

> My team is currently upgrading a rails app from 3.2.3 to 4.0 with JRuby 
> 1.7.10 backed by Oracle.  Under Rails 3.2.3 everything is  nice and 
> happy... 
>
> We have a model called JobMetadata and every numeric column is an 
> integer (although Oracle does store them as Number(38).  The database is 
> unchanged from 3.2.3 to 4.0. 
>
> Suppose I have an instance (of JobMetadata ) called jmd, and I reference 
> jmd.max_execution_time.  jmd.max_execution_time.class is a FixNum ( in 
> 4.0 -- yay). 
>
> If I pull it out in erb (via form_for) it always pulls out a string 
> representation of a float like "60.0" in 4.0 (but "60" in 3.2.3). 
> For example: 
>
> <%= form_for(@job_metadata, :url => { :action => "update" }) do |f| %> 
> <%= f.text_field :max_execution_minutes, :size=>10%> 
>
> Would yield "60" in the text field in 3.2.3 but "60.0" in 4.0. 
> We "fixed" this issue via: 
>
> What does JobMetadata.columns think that the column type is?

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+unsubscr...@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/eaa6c5ce-1eea-49ad-949b-67957f71d014%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.