librelist archives

« back to archive

Rails doesn't automatically create a file

Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 17:14
What do I do when I run  rake db:migrate and one of the files that Rails 
is supposed to create isn't missing?

In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?

However, when I run this against the console, I get: 

$ rails console --sandbox
>> user = User.first
>> user.admin?
=> false
>> user.toggle!(:admin)
=> true
>> user.admin?
=> true
NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.

Any help is appreciated.

Steve

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 17:37
did you accidentally capitalize user? (NoMethodError: undefined method
`admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I
get the same error.

On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:

> What do I do when I run  rake db:migrate and one of the files that Rails
> is supposed to create isn't missing?
>
> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
> Rails fugures outeh bolean nature of the admin attribute and automatically
> adds the question-mark method admin?
>
> However, when I run this against the console, I get:
>
> $ rails console --sandbox>> user = User.first>> user.admin?=> false>> 
user.toggle!(:admin)=> true>> user.admin?=> true
>
> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>
> Any help is appreciated.
>
> Steve
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 17:43
I looked at that to make sure I didn't. The interesting thing is the rspec
spec tests pass (I know a miracle) and it seems to be performing as it 
should. I wonder if I would need to restart the console with al the things
I've changed lately. So far all tests are green today which is a miracle 
in and of itself.


On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:

> did you accidentally capitalize user? (NoMethodError: undefined method 
`admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I 
get the same error.
> 
> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
> What do I do when I run  rake db:migrate and one of the files that Rails
is supposed to create isn't missing?
> 
> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
> 
> However, when I run this against the console, I get: 
> 
> $ rails console --sandbox
> >> user = User.first
> >> user.admin?
> => false
> >> user.toggle!(:admin)
> => true
> >> user.admin?
> => true
> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
> 
> Any help is appreciated.
> 
> Steve
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 17:53
Restarting console can't hurt. I have not quite figured out the algorithm
myself, but spork needs restarting, depending upon what was changed (and I
think guard can be configured to do that - gotta love complexity...)

On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:

> I looked at that to make sure I didn't. The interesting thing is the rspec
> spec tests pass (I know a miracle) and it seems to be performing as it
> should. I wonder if I would need to restart the console with al the things
> I've changed lately. So far all tests are green today which is a miracle in
> and of itself.
>
>
> On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:
>
> did you accidentally capitalize user? (NoMethodError: undefined method
> `admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I
> get the same error.
>
> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>
>> What do I do when I run  rake db:migrate and one of the files that Rails
>> is supposed to create isn't missing?
>>
>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
>> Rails fugures outeh bolean nature of the admin attribute and automatically
>> adds the question-mark method admin?
>>
>> However, when I run this against the console, I get:
>>
>> $ rails console --sandbox>> user = User.first>> user.admin?=> false>> 
user.toggle!(:admin)=> true>> user.admin?=> true
>>
>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>>
>> Any help is appreciated.
>>
>> Steve
>>
>
>
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 18:03
The biggest thing at this point in my Rails career is: if it says it is 
going to do something, and it doesn't, it kinda stresses me.


On Jun 28, 2012, at 11:53 AM, Robert Karlsson wrote:

> Restarting console can't hurt. I have not quite figured out the 
algorithm myself, but spork needs restarting, depending upon what was 
changed (and I think guard can be configured to do that - gotta love 
complexity...)
> 
> On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:
> I looked at that to make sure I didn't. The interesting thing is the 
rspec spec tests pass (I know a miracle) and it seems to be performing as 
it should. I wonder if I would need to restart the console with al the 
things I've changed lately. So far all tests are green today which is a 
miracle in and of itself.
> 
> 
> On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:
> 
>> did you accidentally capitalize user? (NoMethodError: undefined method 
`admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I 
get the same error.
>> 
>> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>> What do I do when I run  rake db:migrate and one of the files that 
Rails is supposed to create isn't missing?
>> 
>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
>> 
>> However, when I run this against the console, I get: 
>> 
>> $ rails console --sandbox
>> >> user = User.first
>> >> user.admin?
>> => false
>> >> user.toggle!(:admin)
>> => true
>> >> user.admin?
>> => true
>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>> 
>> Any help is appreciated.
>> 
>> Steve
>> 
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Allen Maxwell
Date:
2012-06-28 @ 18:13
if you are running spork and tests are failing it always is a good idea to
restart spork.  sometimes you have to restart the server depending (again)
on the kinds of changes you're making.

often, if you're changing the models you'll have to restart spork BUT, 
there are some changes to rspec that can help avoid this.  I don't know 
the details but can dig for some code - it's basically cargo culting 
though so not much understanding behind it on my end.

Max



On Jun 28, 2012, at 12:03 PM, Steve wrote:

> The biggest thing at this point in my Rails career is: if it says it is 
going to do something, and it doesn't, it kinda stresses me.
> 
> 
> On Jun 28, 2012, at 11:53 AM, Robert Karlsson wrote:
> 
>> Restarting console can't hurt. I have not quite figured out the 
algorithm myself, but spork needs restarting, depending upon what was 
changed (and I think guard can be configured to do that - gotta love 
complexity...)
>> 
>> On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:
>> I looked at that to make sure I didn't. The interesting thing is the 
rspec spec tests pass (I know a miracle) and it seems to be performing as 
it should. I wonder if I would need to restart the console with al the 
things I've changed lately. So far all tests are green today which is a 
miracle in and of itself.
>> 
>> 
>> On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:
>> 
>>> did you accidentally capitalize user? (NoMethodError: undefined method
`admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I 
get the same error.
>>> 
>>> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>>> What do I do when I run  rake db:migrate and one of the files that 
Rails is supposed to create isn't missing?
>>> 
>>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
>>> 
>>> However, when I run this against the console, I get: 
>>> 
>>> $ rails console --sandbox
>>> >> user = User.first
>>> >> user.admin?
>>> => false
>>> >> user.toggle!(:admin)
>>> => true
>>> >> user.admin?
>>> => true
>>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>>> 
>>> Any help is appreciated.
>>> 
>>> Steve
>>> 
>> 
>> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 18:17
programming is kinda of a zen thing

On Thu, Jun 28, 2012 at 12:13 PM, Allen Maxwell <aamax@xmission.com> wrote:

> if you are running spork and tests are failing it always is a good idea to
> restart spork.  sometimes you have to restart the server depending (again)
> on the kinds of changes you're making.
>
> often, if you're changing the models you'll have to restart spork BUT,
> there are some changes to rspec that can help avoid this.  I don't know the
> details but can dig for some code - it's basically cargo culting though so
> not much understanding behind it on my end.
>
> Max
>
>
>
> On Jun 28, 2012, at 12:03 PM, Steve wrote:
>
> The biggest thing at this point in my Rails career is: if it says it is
> going to do somet hing, and it doesn't, it kinda stresses me.
>
>
> On Jun 28, 2012, at 11:53 AM, Robert Karlsson wrote:
>
> Restarting console can't hurt. I have not quite figured out the algorithm
> myself, but spork needs restarting, depending upon what was changed (and I
> think guard can be configured to do that - gotta love complexity...)
>
> On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:
>
>> I looked at that to make sure I didn't. The interesting thing is the
>> rspec spec tests pass (I know a miracle) and it seems to be performing as
>> it should. I wonder if I would need to restart the console with al the
>> things I've changed lately. So far all tests are green today which is a
>> miracle in and of itself.
>>
>>
>> On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:
>>
>> did you accidentally capitalize user? (NoMethodError: undefined method
>> `admin?' for #<User:0x000001037af1f8>.)  if I use User instead of user I
>> get the same error.
>>
>> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>>
>>> What do I do when I run  rake db:migrate and one of the files that Rails
>>> is supposed to create isn't missing?
>>>
>>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
>>> Rails fugures outeh bolean nature of the admin attribute and automatically
>>> adds the question-mark method admin?
>>>
>>> However, when I run this against the console, I get:
>>>
>>> $ rails console --sandbox>> user = User.first>> user.admin?=> false>> 
user.toggle!(:admin)=> true>> user.admin?=> true
>>>
>>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>>>
>>> Any help is appreciated.
>>>
>>> Steve
>>>
>>
>>
>>
>
>
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 18:34
But they took Life off the air before my zen training was complete.


On Jun 28, 2012, at 12:17 PM, Robert Karlsson wrote:

> programming is kinda of a zen thing
> 
> On Thu, Jun 28, 2012 at 12:13 PM, Allen Maxwell <aamax@xmission.com> wrote:
> if you are running spork and tests are failing it always is a good idea 
to restart spork.  sometimes you have to restart the server depending 
(again) on the kinds of changes you're making.
> 
> often, if you're changing the models you'll have to restart spork BUT, 
there are some changes to rspec that can help avoid this.  I don't know 
the details but can dig for some code - it's basically cargo culting 
though so not much understanding behind it on my end.
> 
> Max
> 
> 
> 
> On Jun 28, 2012, at 12:03 PM, Steve wrote:
> 
>> The biggest thing at this point in my Rails career is: if it says it is
going to do somet hing, and it doesn't, it kinda stresses me.
>> 
>> 
>> On Jun 28, 2012, at 11:53 AM, Robert Karlsson wrote:
>> 
>>> Restarting console can't hurt. I have not quite figured out the 
algorithm myself, but spork needs restarting, depending upon what was 
changed (and I think guard can be configured to do that - gotta love 
complexity...)
>>> 
>>> On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:
>>> I looked at that to make sure I didn't. The interesting thing is the 
rspec spec tests pass (I know a miracle) and it seems to be performing as 
it should. I wonder if I would need to restart the console with al the 
things I've changed lately. So far all tests are green today which is a 
miracle in and of itself.
>>> 
>>> 
>>> On Jun 28, 2012, at 11:37 AM, Robert Karlsson wrote:
>>> 
>>>> did you accidentally capitalize user? (NoMethodError: undefined 
method `admin?' for #<User:0x000001037af1f8>.)  if I use User instead of 
user I get the same error.
>>>> 
>>>> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>>>> What do I do when I run  rake db:migrate and one of the files that 
Rails is supposed to create isn't missing?
>>>> 
>>>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As 
expected, Rails fugures outeh bolean nature of the admin attribute and 
automatically adds the question-mark method admin?
>>>> 
>>>> However, when I run this against the console, I get: 
>>>> 
>>>> $ rails console --sandbox
>>>> >> user = User.first
>>>> >> user.admin?
>>>> => false
>>>> >> user.toggle!(:admin)
>>>> => true
>>>> >> user.admin?
>>>> => true
>>>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>>>> 
>>>> Any help is appreciated.
>>>> 
>>>> Steve
>>>> 
>>> 
>>> 
>> 
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
David Richards
Date:
2012-06-28 @ 18:38
Ha!  Life was a good show.  I still watch it (over and over again) on
Netflix.

Seriously, though.  Beginners Mind is good for programmers (Zen training).
 It helps you have calm inquisitiveness and learn from your programming.

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Allen Maxwell
Date:
2012-06-28 @ 18:50
another path is:  M16s with lots of ammo … 


On Jun 28, 2012, at 12:38 PM, David Richards wrote:

> Ha!  Life was a good show.  I still watch it (over and over again) on Netflix.
> 
> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 19:01
Now that I can get on board with.

On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:

> another path is:  M16s with lots of ammo … 
> 
> 
> On Jun 28, 2012, at 12:38 PM, David Richards wrote:
> 
>> Ha!  Life was a good show.  I still watch it (over and over again) on Netflix.
>> 
>> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 19:03
I vote for a rich divorcee

On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:

> Now that I can get on board with.
>
> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
>
> > another path is:  M16s with lots of ammo …
> >
> >
> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
> >
> >> Ha!  Life was a good show.  I still watch it (over and over again) on
> Netflix.
> >>
> >> Seriously, though.  Beginners Mind is good for programmers (Zen
> training).  It helps you have calm inquisitiveness and learn from your
> programming.
> >
>
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 19:14
Well, I finished chapter 9 with two errors that are eerily similar to the 
debacle that 7 turned into. The output shows it is correct and even 
functions exactly as it is instructed to. However, rspec keeps throwing up
saying it can't find a delete link. I said screw it and pushed it up to 
gitHub.

I'm moving on to chap. 10. I might comment out that test so i don't get 
anymore rspec puke on me.

On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:

> I vote for a rich divorcee
> 
> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
> Now that I can get on board with.
> 
> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
> 
> > another path is:  M16s with lots of ammo …
> >
> >
> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
> >
> >> Ha!  Life was a good show.  I still watch it (over and over again) on
Netflix.
> >>
> >> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.
> >
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 19:22
are you running spork? (you should be).  if rspec seems wrong - restarting
spork almost always clears it up.


On Thu, Jun 28, 2012 at 1:14 PM, Steve <steve@mach4ws.com> wrote:

> Well, I finished chapter 9 with two errors that are eerily similar to the
> debacle that 7 turned into. The output shows it is correct and even
> functions exactly as it is instructed to. However, rspec keeps throwing up
> saying it can't find a delete link. I said screw it and pushed it up to
> gitHub.
>
> I'm moving on to chap. 10. I might comment out that test so i don't get
> anymore rspec puke on me.
>
> On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:
>
> I vote for a rich divorcee
>
> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
>
>> Now that I can get on board with.
>>
>> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
>>
>> > another path is:  M16s with lots of ammo …
>> >
>> >
>> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
>> >
>> >> Ha!  Life was a good show.  I still watch it (over and over again) on
>> Netflix.
>> >>
>> >> Seriously, though.  Beginners Mind is good for programmers (Zen
>> training).  It helps you have calm inquisitiveness and learn from your
>> programming.
>> >
>>
>>
>
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 19:26
I never loaded spork. I guess I should go back to that step and load it up.

On Jun 28, 2012, at 1:22 PM, Robert Karlsson wrote:

> are you running spork? (you should be).  if rspec seems wrong - 
restarting spork almost always clears it up.
> 
> 
> On Thu, Jun 28, 2012 at 1:14 PM, Steve <steve@mach4ws.com> wrote:
> Well, I finished chapter 9 with two errors that are eerily similar to 
the debacle that 7 turned into. The output shows it is correct and even 
functions exactly as it is instructed to. However, rspec keeps throwing up
saying it can't find a delete link. I said screw it and pushed it up to 
gitHub.
> 
> I'm moving on to chap. 10. I might comment out that test so i don't get 
anymore rspec puke on me.
> 
> On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:
> 
>> I vote for a rich divorcee
>> 
>> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
>> Now that I can get on board with.
>> 
>> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
>> 
>> > another path is:  M16s with lots of ammo …
>> >
>> >
>> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
>> >
>> >> Ha!  Life was a good show.  I still watch it (over and over again) 
on Netflix.
>> >>
>> >> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.
>> >
>> 
>> 
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 19:09
That would be hard to defend to my wife.


On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:

> I vote for a rich divorcee
> 
> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
> Now that I can get on board with.
> 
> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
> 
> > another path is:  M16s with lots of ammo …
> >
> >
> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
> >
> >> Ha!  Life was a good show.  I still watch it (over and over again) on
Netflix.
> >>
> >> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.
> >
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 19:21
you are in utah.

On Thu, Jun 28, 2012 at 1:09 PM, Steve <steve@mach4ws.com> wrote:

> That would be hard to defend to my wife.
>
>
> On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:
>
> I vote for a rich divorcee
>
> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
>
>> Now that I can get on board with.
>>
>> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
>>
>> > another path is:  M16s with lots of ammo …
>> >
>> >
>> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
>> >
>> >> Ha!  Life was a good show.  I still watch it (over and over again) on
>> Netflix.
>> >>
>> >> Seriously, though.  Beginners Mind is good for programmers (Zen
>> training).  It helps you have calm inquisitiveness and learn from your
>> programming.
>> >
>>
>>
>
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 19:26
She would still kick my butt.

On Jun 28, 2012, at 1:21 PM, Robert Karlsson wrote:

> you are in utah.
> 
> On Thu, Jun 28, 2012 at 1:09 PM, Steve <steve@mach4ws.com> wrote:
> That would be hard to defend to my wife.
> 
> 
> On Jun 28, 2012, at 1:03 PM, Robert Karlsson wrote:
> 
>> I vote for a rich divorcee
>> 
>> On Thu, Jun 28, 2012 at 1:01 PM, Steve <steve@mach4ws.com> wrote:
>> Now that I can get on board with.
>> 
>> On Jun 28, 2012, at 12:50 PM, Allen Maxwell wrote:
>> 
>> > another path is:  M16s with lots of ammo …
>> >
>> >
>> > On Jun 28, 2012, at 12:38 PM, David Richards wrote:
>> >
>> >> Ha!  Life was a good show.  I still watch it (over and over again) 
on Netflix.
>> >>
>> >> Seriously, though.  Beginners Mind is good for programmers (Zen 
training).  It helps you have calm inquisitiveness and learn from your 
programming.
>> >
>> 
>> 
> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Robert Karlsson
Date:
2012-06-28 @ 17:24
did you do these steps?

rails generate migration add_admin_to_users admin:boolean

The migration simply adds the admin column to the users table (Listing

9.40<http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code:admin_migration>),
yielding the data model in Figure

9.13<http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#fig:user_model_admin>
.
Listing 9.40. The migration to add a boolean admin attribute to users.
db/migrate/[timestamp]_add_admin_to_users.rb

class AddAdminToUsers < ActiveRecord::Migration
  def change
    add_column :users, :admin, :boolean, default: false
  endend



On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:

> What do I do when I run  rake db:migrate and one of the files that Rails
> is supposed to create isn't missing?
>
> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
> Rails fugures outeh bolean nature of the admin attribute and automatically
> adds the question-mark method admin?
>
> However, when I run this against the console, I get:
>
> $ rails console --sandbox>> user = User.first>> user.admin?=> false>> 
user.toggle!(:admin)=> true>> user.admin?=> true
>
> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>
> Any help is appreciated.
>
> Steve
>

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 17:30
I did.

On Jun 28, 2012, at 11:24 AM, Robert Karlsson wrote:

> did you do these steps?
> 
> rails generate migration add_admin_to_users admin:boolean
> The migration simply adds the admin column to the users table (Listing 
9.40), yielding the data model in Figure 9.13.
> 
> Listing 9.40. The migration to add a boolean admin attribute to users. 
> db/migrate/[timestamp]_add_admin_to_users.rb
> class AddAdminToUsers < ActiveRecord::Migration
>   def change
>     add_column :users, :admin, :boolean, default: false
>   end
> end
> 
> 
> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
> What do I do when I run  rake db:migrate and one of the files that Rails
is supposed to create isn't missing?
> 
> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
> 
> However, when I run this against the console, I get: 
> 
> $ rails console --sandbox
> >> user = User.first
> >> user.admin?
> => false
> >> user.toggle!(:admin)
> => true
> >> user.admin?
> => true
> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
> 
> Any help is appreciated.
> 
> Steve
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Allen Maxwell
Date:
2012-06-28 @ 17:33
from your console steps it's clear that the user.admin? is working because
it shows false initially and then true on the next attempt after you've 
toggled the admin flag..


I'd want to play with this a bit, after creating a user enter "puts 
user.inspect" and see what you get, do the same after the call to admin? 
(in each place)… the error seems odd in that it actually seems to be 
performing the admin? method and THEN reporting that it doesn't find it… 

off the top of my head.

Max

On Jun 28, 2012, at 11:24 AM, Robert Karlsson wrote:

> did you do these steps?
> 
> rails generate migration add_admin_to_users admin:boolean
> The migration simply adds the admin column to the users table (Listing 
9.40), yielding the data model in Figure 9.13.
> 
> Listing 9.40. The migration to add a boolean admin attribute to users. 
> db/migrate/[timestamp]_add_admin_to_users.rb
> class AddAdminToUsers < ActiveRecord::Migration
>   def change
>     add_column :users, :admin, :boolean, default: false
>   end
> end
> 
> 
> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
> What do I do when I run  rake db:migrate and one of the files that Rails
is supposed to create isn't missing?
> 
> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
> 
> However, when I run this against the console, I get: 
> 
> $ rails console --sandbox
> >> user = User.first
> >> user.admin?
> => false
> >> user.toggle!(:admin)
> => true
> >> user.admin?
> => true
> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
> 
> Any help is appreciated.
> 
> Steve
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
Steve
Date:
2012-06-28 @ 17:43
I'll do that Max thanks.


On Jun 28, 2012, at 11:33 AM, Allen Maxwell wrote:

> from your console steps it's clear that the user.admin? is working 
because it shows false initially and then true on the next attempt after 
you've toggled the admin flag..
> 
> 
> I'd want to play with this a bit, after creating a user enter "puts 
user.inspect" and see what you get, do the same after the call to admin? 
(in each place)… the error seems odd in that it actually seems to be 
performing the admin? method and THEN reporting that it doesn't find it… 
> 
> off the top of my head.
> 
> Max
> 
> On Jun 28, 2012, at 11:24 AM, Robert Karlsson wrote:
> 
>> did you do these steps?
>> 
>> rails generate migration add_admin_to_users admin:boolean
>> The migration simply adds the admin column to the users table (Listing 
9.40), yielding the data model in Figure 9.13.
>> 
>> Listing 9.40. The migration to add a boolean admin attribute to users. 
>> db/migrate/[timestamp]_add_admin_to_users.rb
>> class AddAdminToUsers < ActiveRecord::Migration
>>   def change
>>     add_column :users, :admin, :boolean, default: false
>>   end
>> end
>> 
>> 
>> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>> What do I do when I run  rake db:migrate and one of the files that 
Rails is supposed to create isn't missing?
>> 
>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected, 
Rails fugures outeh bolean nature of the admin attribute and automatically
adds the question-mark method admin?
>> 
>> However, when I run this against the console, I get: 
>> 
>> $ rails console --sandbox
>> >> user = User.first
>> >> user.admin?
>> => false
>> >> user.toggle!(:admin)
>> => true
>> >> user.admin?
>> => true
>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>> 
>> Any help is appreciated.
>> 
>> Steve
>> 
> 

Re: [getarailsjob] Rails doesn't automatically create a file

From:
David Richards
Date:
2012-06-28 @ 17:48
Guys, this is so cool!!  I was on the phone with a client, but watching
this hit my inbox, I love the Ruby community (how we help each other out
like this)!

On Thu, Jun 28, 2012 at 11:43 AM, Steve <steve@mach4ws.com> wrote:

> I'll do that Max thanks.
>
>
> On Jun 28, 2012, at 11:33 AM, Allen Maxwell wrote:
>
> from your console steps it's clear that the user.admin? is working because
> it shows false initially and then true on the next attempt after you've
> toggled the admin flag..
>
>
> I'd want to play with this a bit, after creating a user enter "puts
> user.inspect" and see what you get, do the same after the call to admin?
> (in each place)… the error seems odd in that it actually seems to be
> performing the admin? method and THEN reporting that it doesn't find it…
>
> off the top of my head.
>
> Max
>
> On Jun 28, 2012, at 11:24 AM, Robert Karlsson wrote:
>
> did you do these steps?
>
>  rails generate migration add_admin_to_users admin:boolean
>
> The migration simply adds the admin column to the users table (
> Listing 
9.40<http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code:admin_migration>),
> yielding the data model in Figure 
9.13<http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#fig:user_model_admin>
> .
>  Listing 9.40. The migration to add a boolean admin attribute to users.
> db/migrate/[timestamp]_add_admin_to_users.rb
>
> class AddAdminToUsers < ActiveRecord::Migration
>   def change
>     add_column :users, :admin, :boolean, default: false
>   endend
>
>
>
> On Thu, Jun 28, 2012 at 11:14 AM, Steve <steve@mach4ws.com> wrote:
>
>> What do I do when I run  rake db:migrate and one of the files that Rails
>> is supposed to create isn't missing?
>>
>> In rubyonrailstutorial.org chapter 9 section 4, it says: "As expected,
>> Rails fugures outeh bolean nature of the admin attribute and automatically
>> adds the question-mark method admin?
>>
>> However, when I run this against the console, I get:
>>
>> $ rails console --sandbox>> user = User.first>> user.admin?=> false>> 
user.toggle!(:admin)=> true>> user.admin?=> true
>>
>> NoMethodError: undefined method `admin?' for #<User:0x000001037af1f8>.
>>
>> Any help is appreciated.
>>
>> Steve
>>
>
>
>
>