*User.rb*
has_many :looking_for_whos, :class_name = UserLookingForWho
has_many :asset_looking_for_whos, :through = :looking_for_whos
belongs_to :asset_usertype
In a controller i can do the following:
*@users = User.where(asset_usertype_id: [current_user.looking_for_who_ids])*
to get all
Class User
has_many :settings, :class_name = UserSetting, :foreign_key = user_id
Class UserSetting
belongs_to :user
In UserSetting i have
class self
def set(name, value)
setting = [here i need the calling user
object].settings.find_or_initialize_by_name(name)
end
end
what i
Thank you for a great answer, i wanted to move it from the User model - but
i guess the smartest way is to keep it in there, also did the renaming
to update_setting ...
Again thank you!
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To
Thanks, got it sort of working. Would like to drop
ActiveRecord::Base from Post (don't want to create a table for Posts)
just the TextPost and LinkPost, will work on that tonight.
Thanks again.
/Niklas.
On 16 Dec, 11:07, Xuan xua...@gmail.com wrote:
On 16 dic, 08:11, Niklas Nson niklasn
Need some help with understanding the best way of doing the
following:
I have a user model and two models (link_post and text_post) i now
want to join the models together as post.
both link_post and text_post has a user_id column.
What a i want is to get
u = User.first
u.posts
to
I need to validate a string from a user (a location for use with
geotagging) that is. I want to make sure that the user specify a city
and a country in my inp ... So i wrote this =
validates :usri_location,
:presence = true,
:format = {:with =
Thanks - this is a bookmark from now on...
On 12 Aug, 15:35, Leigh Daniels leighdaniel...@gmail.com wrote:
Try usinghttp://rubular.com/. I use this a lot because it's fast (most of the
time) and interactive.
**Leigh
I need to validate a string from a user (a location for use with
Thanks for all help!
On 12 Aug, 15:34, Juan Alvarado jcalva...@gmail.com wrote:
On Aug 12, 2011, at 9:21 AM, Colin Law wrote:
On 12 August 2011 14:08, Niklas Nson niklasn...@meantime.se wrote:
I need to validate a string from a user (a location for use with
geotagging) that is. I want
Thanks :)
On 12 Aug, 16:19, 7stud -- li...@ruby-forum.com wrote:
Juan Alvarado wrote in post #1016383:
On Aug 12, 2011, at 9:21 AM, Colin Law wrote:
On 12 August 2011 14:08, Niklas Nson niklasn...@meantime.se wrote:
I need to validate a string from a user (a location for use
If i remove //= require_tree . it works...
On 7 Juli, 07:49, Niklas Nson niklasn...@meantime.se wrote:
Trying to get jQuery UI to work with my rails 3.1 setup, but i keep
getting errors that i cant see posted anywhere, this is driving my
insane so please have a look =
[application.js
Trying to get jQuery UI to work with my rails 3.1 setup, but i keep
getting errors that i cant see posted anywhere, this is driving my
insane so please have a look =
[application.js]
// This is a manifest file that'll be compiled into including all the
files listed below.
// Add new
This is currentlymaking my head spin, and it looks like i cant get a
clear answer: so im turning to you.
In my sandbox application i have users and these have profiles: in
profiles i store information like a about me and country, state and
city. And some other information (all who the user select
, or is the
ghost_of_many_sql_questions just
in my head ?
On 6 Juni, 18:03, Walter Davis wa...@wdstudio.com wrote:
On Jun 6, 2011, at 10:45 AM, Niklas Nson wrote:
This is currentlymaking my head spin, and it looks like i cant get a
clear answer: so im turning to you.
In my sandbox application i have
Im in love with meta_search, a great gem but i have a question: when
using it in controllers wich has the same name as the model (Photo =
PhotosController) it workes like a charm. But i have a
PeoplesController for handling accounts, profiles etc - and if i try
to use it there i get an error of:
, 17:05, David Kahn d...@structuralartistry.com wrote:
On Tue, May 24, 2011 at 9:35 AM, Niklas Nson niklasn...@meantime.se wrote:
Im in love with meta_search, a great gem but i have a question: when
using it in controllers wich has the same name as the model (Photo =
PhotosController
, Niklas Nson niklasn...@meantime.sewrote:
Thanks for your reply - sadly i cant get it working.
:routes =
match /peoples = peoples#index, :as = peoples
Both accounts_ and _account results in
undefined method `account(s)_screen_name_contains' for
#ActiveRecord::Relation:0x106ae3da8
Can i
And no way of letting the PeopleController letting it know that it
should user Accounts ?
/Niklas.
On 24 Maj, 20:30, David Kahn d...@structuralartistry.com wrote:
On Tue, May 24, 2011 at 1:14 PM, Niklas Nson niklasn...@meantime.se wrote:
I think i have mislead you with the subject line
was in that Account was the model and then a
PeoplesController. But after your last message i think this should not
matter ?
Grateful for all help,
/Niklas.
On 24 Maj, 21:30, David Kahn d...@structuralartistry.com wrote:
On Tue, May 24, 2011 at 1:55 PM, Niklas Nson niklasn...@meantime.se wrote:
And no way
Kahn d...@structuralartistry.com wrote:
On Tue, May 24, 2011 at 3:05 PM, Niklas Nson niklasn...@meantime.se wrote:
This is what i got:
class PeoplesController ApplicationController
def index
@search = Account.search(params[:search])
@users = @search.where(:status =
active
, Niklas Nson niklasn...@meantime.se wrote:
I have made myself a small activity model like this =
# == Schema Information
# Schema version: 20110519174324
#
# Table name: activities
#
# id :integer not null, primary key
# account_id :integer
# action :string
Got it working, you are my hero!
On 21 Maj, 17:00, Matt Jones al2o...@gmail.com wrote:
On May 20, 11:48 am, Niklas Nson niklasn...@meantime.se wrote:
I have made myself a small activity model like this =
# == Schema Information
# Schema version: 20110519174324
#
# Table name
I have made myself a small activity model like this =
# == Schema Information
# Schema version: 20110519174324
#
# Table name: activities
#
# id :integer not null, primary key
# account_id :integer
# action :string(255)
# item_id:integer
# item_type :string(255)
#
I have this form and i got it working as i want:
%= form_tag(update_individual_photos_path, :method = put) do %
%= fields_for photos[], @photo do |f| %
.
% end -%
%= submit_tag(Post) %
% end %
But i would like to move to doing this with simple_form_for and
Have the following form:
%= simple_form_for @user, :as = :user, :action =
edit_notification do |f| -%
%= f.input :email %
%= f.input :email_alerts %
%= f.input :email_summarize %
%= f.input
I have a has_many association and does some adding throug a nested
form, i can add objects (images) and edit text this works fine. But
when i try to delete items nothing happens. This is what my log looks
like:
Started POST /photosets/168 for 127.0.0.1 at Fri Apr 15 07:34:04
+0200 2011
Does not match :controller(/:action(/:id(.:format))) do the
routing ?
I thought it should look in controller and if not found look in public/
javascript ?
//Niklas
On 23 Feb, 14:05, Hassan Schroeder hassan.schroe...@gmail.com wrote:
On Tue, Feb 22, 2011 at 8:33 PM, Niklas Nson niklasn
Hassan, you are my hero Thank you for taking time ... Got it
working :)
/Niklas
On 23 Feb, 14:25, Hassan Schroeder hassan.schroe...@gmail.com wrote:
On Wed, Feb 23, 2011 at 5:17 AM, Niklas Nson niklasn...@meantime.se wrote:
Does not match :controller(/:action(/:id(.:format))) do
That gives me the error (in firebug)
illegal XML character
[Stop on error] var states = %= @states.collect {|st...ountry_id,
h(state.name)]}.to_json %
On 22 Feb, 08:22, Jim Ruther Nill jvn...@gmail.com wrote:
On Tue, Feb 22, 2011 at 2:53 PM, Niklas Nson niklasn...@meantime.se wrote:
Trying
:controller(/:action(/:id(.:format)))
Do i need to do some other configs ?
On 22 Feb, 16:47, Hassan Schroeder hassan.schroe...@gmail.com wrote:
On Tue, Feb 22, 2011 at 12:05 AM, Niklas Nson niklasn...@meantime.se wrote:
That gives me the error (in firebug)
illegal XML character
[Stop
...@gmail.com wrote:
On Tue, Feb 22, 2011 at 12:05 AM, Niklas Nson niklasn...@meantime.se wrote:
That gives me the error (in firebug)
illegal XML character
[Stop on error] var states = %= @states.collect {|st...ountry_id,
h(state.name)]}.to_json %
If that's what the client is seeing, it would
= State.find(:all)
@citys = City.find(:all)
end
end
//Niklas
On 22 Feb, 20:25, Hassan Schroeder hassan.schroe...@gmail.com wrote:
On Tue, Feb 22, 2011 at 10:51 AM, Niklas Nson niklasn...@meantime.se wrote:
Yes i also belive that it dosent fire up. If i go to :
http://localhost:3000
Trying to follow railscast #88, i know the js.erb file is loaded but
when i try to insert ruby code in the .js.erb file i get an error
illegal XML character i have added the following line to my routes
file
match :controller(/:action(/:id(.:format)))
and code not working is:
...
var
I would need some help on pointing me to the correct direction. In
application i would like users to be abel to select genres for work
they like to do. A user can be willing to do a lot of genres or just
one. If i still was writing code in .NET i would do a string of id's
and then save them to the
Thanks, will have a look @ polymorphic associations, looks like what i
want! If i can get it to work.
Thanks again!
/Niklas.
On 13 Jan, 18:15, Arailsdemo A. li...@ruby-forum.com wrote:
Looks like you have Casting has_many :comments, and you have a comment
form on your Casting show page. If so,
Background:
On my application users can post Castings [class Casting] now i want
other users to be abel to post Comments on the Castings
[Castingcomment].
Approach:
views/castings/show.html.erb '
%= render :partial = 'castingcomment_form' %
app/controllers/castingcomments_controller.rb
35 matches
Mail list logo