Re: [Rails] Statusify: An open-source web-application status app, written entirely in Ruby on Rails.

2015-10-08 Thread Umang Raghuvanshi
By service incidents, I mean that you can use Statusify to report downtime on 
your web service, inform users of scheduled maintainence and stuff. I'd like to 
apologize for the credentials not working, but that's fixed now. Thanks for 
having a look. 

-- 
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/04ebe7fe-900c-43d0-a3d7-69070125377a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Listing & Editing Profile Pages -

2015-10-08 Thread Greg Bressler
I am relatively new to this and completely lost.  I'm trying to make a
user's profile page.  If the user is an admin, they can see all the
users, as well as access and edit/update each user's profile page.

I finally got it to work...but when I logged in as a user I received
several errors which can be noted in the accompanying jpgs.

The first jpg is the url that I am assuming the user will go to for
their profile page.

The second jpg (User-Index) is the error I get when I try to access the
index page as a non-admin.

The third jpg (User-Edit) is the error I get when I try to access the
Edit page for a user account as a non-admin.

The project can be found at:  https://github.com/GBressler/esl-site

Any help that could be proved on these issues would be greatly
appreciated.

Here is my Users Controller:

class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]

  def index
if current_user.id == 1
  @users = User.all
else
  render 'profile_page'
end
  end

  def show
render 'profile_page'
authorize! :show, @user
@user = User.find(params[:id])
current_user.first_name
  end

  def update
  end

  def edit
authorize! :edit, @user
  end

  def destroy
  end

  private

def set_user
 @user = User.find(params[:id])
end


  def user_params
params.require(:user).permit(:id, :first_name, :last_name, :email,
:username)
  end
end


Here's the code for my yet-to-be developed Edit and Profile Page:
hi

<%= @user.username %>

Here's the code for the index page that the admin sees:

Listing users

<% if notice %>
<%= notice %>
<% end %>



  

  Name
  Username
  
  

  

  
<% @users.each do |user| %>
  
<%= user.first_name %>
<%= user.username %>
<%= link_to 'Show', user %>
<%= link_to 'Edit', edit_user_path(user) if can?(:edit,
user)%>
<%= link_to 'Destroy', user, method: :delete,
data: { confirm: 'Are you sure?' } %>
  
<% end %>
  




Attachments:
http://www.ruby-forum.com/attachment/11128/nonadmin-user-page.jpg
http://www.ruby-forum.com/attachment/11129/User-Index.jpg
http://www.ruby-forum.com/attachment/11130/User-Edit.jpg


-- 
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/577c4063b06602f948c7795bce4bf906%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Active Record has_one through

2015-10-08 Thread Matt Jones


On Wednesday, 7 October 2015 20:47:54 UTC-4, Ruby-Forum.com User wrote:
>
> I have two tables in my app which I am attempting to relate through a 
> join table.  The Artist class which uses 'has_many through', works as 
> expected.  However, the Event class using 'has_one through', brings back 
> nil. 
>
> class Artist < ActiveRecord::Base 
>   has_many :artist_events, dependent: :destroy 
>   has_many :events, through: :artist_events 
> end 
>
> class Event < ActiveRecord::Base 
>   belongs_to :artist_event 

  has_one :artist, through: :artist_events 
>

Something hasn't been copied correctly here, because this shouldn't work - 
the `through` refers to an association (artist_events) that doesn't exist 
on Event.

As noted elsewhere, `belongs_to` is likely not the right association to use 
here; it's expecting an 'artist_event_id' column on the 'events' table.

You'll also want to carefully consider if `has_one` is the right 
association as well. The table structure you've set up (Artist / 
ArtistEvent / Event) is a classic many-to-many relationship. If an Event 
can truly only have one artist, this structure is not needed. If an Event 
can have many artists, than a has_one isn't correct.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+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/2fa1934c-fe96-42e6-bcb2-fa4575d30f8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Could not find gem 'tzinfo-data (>= 0) x86-mingw32'

2015-10-08 Thread Matt Jones


On Thursday, 8 October 2015 12:09:54 UTC-4, arif ullah wrote:
>
>
> 
>
>
> 
>
>
> 
>
> So many time i'm trying to solve this problem,but still now i'm failed. 
> I'm using windows 10
>
>
> Please help me to solve this problem.   
>

First off, don't post screenshots. They get hidden by default in the Google 
Groups interface, and they're just harder-to-read pictures of text you 
could have copied directly.

Secondly, the first error message says: "Run `bundle install` to install 
missing gems." Have you tried that yet? If so, what happens?

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+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/a419b791-dadd-418e-a562-1cc156708666%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Could not find gem 'tzinfo-data (>= 0) x86-mingw32'

2015-10-08 Thread arif ullah








So many time i'm trying to solve this problem,but still now i'm failed. I'm 
using windows 10


Please help me to solve this problem.   

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+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/9ecfe48b-a519-48d6-bc7d-9a6f94c7f558%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: please advise on my helper for table cells

2015-10-08 Thread Jedrin

Maybe I could do this .. good idea .. I've been doing too much JavaScript 
lately 

class NullObject
  def self.method_missing(sym, *args, &block)
  return nil
end
end

-- 
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/de1fede0-a1a8-4b1e-8da1-a421ae9e5f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] please advise on my helper for table cells

2015-10-08 Thread Dave Aronson
On Thu, Oct 8, 2015 at 10:39 AM, Jedrin  wrote:

>  I have a helper like this:
>
>   def table_elements(qualifier, count)
> if qualifier
>   yield
> else
>   return ("" * count).html_safe
> end
>   end

Try a NullObject.  That is, supposing qualifier is of type Client,
have a class NullClient where remittance_id and availability_date are
nil.  Make your data include NullClients instead of any nils.  If I
remember rightly, a couple years ago Avdi Grimm put out a gem that
does a lot of the boilerplate in applying the Null Object pattern.

-Dave

-- 
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.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/CAHxKQih_z1DP51hMp3xMmaebf%2BQBkS1a05D4Unud9ymtVuUqrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: please advise on my helper for table cells

2015-10-08 Thread Jedrin

So this works perfectly but I am not sure why and I suspect I would not get 
any points for being elegant. If someone can comment on this or provide a 
better solution I would appreciate it 


  def table_elements(qualifier, count)
if qualifier
  yield
  return ""
else
  return ("" * count).html_safe
end
  end

-- 
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/ec6dcd37-247a-4f0e-813b-37f3e3c042ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] please advise on my helper for table cells

2015-10-08 Thread Jedrin

 I have a helper like this:

  def table_elements(qualifier, count)
if qualifier
  yield
else
  return ("" * count).html_safe
end
  end
  

Then if I do this, what I want to happen is if resp is not null then it 
yields the block, otherwise it
yields two empty table cells. 

<%= table_elements(resp,2) do %>
  <%= resp.remittance_id %>
  <%= resp.availability_date %>
<% end %>


 Since I have read alot of rails books and blogs and never seen anything 
quite this odd, I suspect someone will suggest an alternate way of doing 
this but at the moment I can't think of anything different. This helper 
almost works the way intended, but for some reason 3 extra ending tags 
 are getting thrown into the beginning of the page .. 


-- 
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/a4aa90b8-cd44-451b-8b85-ecc477c3db9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Active Record has_one through

2015-10-08 Thread Colin Law
On 8 October 2015 at 01:46, Chris Berry  wrote:
> I have two tables in my app which I am attempting to relate through a
> join table.  The Artist class which uses 'has_many through', works as
> expected.  However, the Event class using 'has_one through', brings back
> nil.
>
> class Artist < ActiveRecord::Base
>   has_many :artist_events, dependent: :destroy
>   has_many :events, through: :artist_events
> end
>
> class Event < ActiveRecord::Base
>   belongs_to :artist_event
>   has_one :artist, through: :artist_events

I have not done this but I think it should be
has_one :artist_event   # to match ArtistEvent belongs_to event
has_one :artist through: artist_event  # note, singular artist_event

However, in this scenario I don't think you need the join table at
all, why not just have
Artist has_many events
Event belongs_to artist

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+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/CAL%3D0gLtAACybt_Gu%2B%2BQx0bnnOmVwOoaznKAgv9hW7X4Ks_k5oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Share video learn Ruby on rail

2015-10-08 Thread Hau Truong
This is playlist tutorial video learn ruby on rail basic :
https://www.youtube.com/watch?v=3Igs19iyuTA&list=PLlrM8WMLpf4-JKNyr35vy81aHAKW-pAf5

-- 
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/1949195493792b3deebf14feca3c2bcb%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.